Page 1 of 1

Creating TUniSQLMonitor from runtime doesn't register SQLmon

Posted: Wed 19 Jan 2011 07:43
by horsi
Lets look at this "call stack":

Code: Select all

TUniSQLMonitor.Create
  TCustomDASQLMonitor.Create
    TCustomDASQLMonitor.SetActive
      TCustomDASQLMonitor.RegisterClient (*)
(*) RegisterClient checks "GetMonitor = Self".
Because we are inside "TUniSQLMonitor.Create", global variable UniSQLMonitor.UniMonitor is not yet initialized by "Self"!
GetMonitor results NIL and registering SQL monitor client fails.

If think, the best (and the simplest) solution is to move instruction:

Code: Select all

  if (csDesigning in ComponentState) or (AOwner = nil) or not (csReading in AOwner.ComponentState) then
    Active := True
from the "constructor TCustomDASQLMonitor.Create" to procedure "TCustomDASQLMonitor.AfterConstruction" (replacing"AOwner" parameter with "Owner" property).

Posted: Wed 19 Jan 2011 09:55
by AlexP
Hello,

Thank you for the information.
We have already fixed the problem.
This fix will be included in the next build.

Posted: Thu 17 Feb 2011 06:26
by horsi
AlexP wrote:Hello,

Thank you for the information.
We have already fixed the problem.
This fix will be included in the next build.
Hello,

I latest build (3.60.0.15) doesn't solve the problem.
I know that from the technical side TCustomDASQLMonitor has changed. There is a new protected virtual method called "NeedAutoActivate". It extracts some code from the constructor. But from the user side, nothing has changed.

Still creating TUniSQLMonitor from runtime doesn't register Borland SQL Monitor.

Posted: Thu 17 Feb 2011 13:17
by AlexP
Hello,

Thank you for the information.
We have reproduced this problem and fixed it.
This fix will be included in the next build.