Creating TUniSQLMonitor from runtime doesn't register SQLmon

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
horsi
Posts: 14
Joined: Sat 15 Jan 2011 07:19

Creating TUniSQLMonitor from runtime doesn't register SQLmon

Post by horsi » Wed 19 Jan 2011 07:43

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).

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Wed 19 Jan 2011 09:55

Hello,

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

horsi
Posts: 14
Joined: Sat 15 Jan 2011 07:19

Post by horsi » Thu 17 Feb 2011 06:26

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.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Thu 17 Feb 2011 13:17

Hello,

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

Post Reply