Subject | Callback problem with TIB_Dataset |
---|---|
Author | Don Schoeman |
Post date | 2006-11-29T12:39:03Z |
Hi guys,
I believe I may have discovered a rare issue within TIB_Dataset which may
translate to other IBO components too. I'm using an old version of IBO
(v4.3.Aa) so there is a possibility that this may have been fixed already.
I've developed a multi-threaded server with one of the threads accessing a
Firebird server via IBO. It's been running very well for a while now but
I've recently discovered a problem. TIB_Dataset has a method called
DefaultProcessCallback() which is called when no OnCallback event handler
has been assigned to a TIB_Dataset derived component.
The DefaultProcessCallback method creates an instance of the TdlgCancelQuery
form which displays the current progress as well as a Cancel button:
dlgCancelQuery := TdlgCancelQuery.Create( Application );
This form is created with the TApplication instance as owner. However,
accessing the Application instance is a big no-no in multi-threaded apps.
This sometimes causes my database thread to die a horrible death. I've
managed to easily get around the problem by assigning a dummy OnCallback
event handler to my TIB_Query components. This causes the TIB_Dataset
component not to create its own handler.
I suggest that in order to fix this problem (if it's not fixed yet) is to
add an additional property to the TIB_Dataset class which allows one to
Disable the callback functionality alltogether, perhaps something like
CallbackDisable. When set to true it should skip any Callback functionality.
This might make more sense than having to assign a dummy callback routine.
Regards,
Don Schoeman
I believe I may have discovered a rare issue within TIB_Dataset which may
translate to other IBO components too. I'm using an old version of IBO
(v4.3.Aa) so there is a possibility that this may have been fixed already.
I've developed a multi-threaded server with one of the threads accessing a
Firebird server via IBO. It's been running very well for a while now but
I've recently discovered a problem. TIB_Dataset has a method called
DefaultProcessCallback() which is called when no OnCallback event handler
has been assigned to a TIB_Dataset derived component.
The DefaultProcessCallback method creates an instance of the TdlgCancelQuery
form which displays the current progress as well as a Cancel button:
dlgCancelQuery := TdlgCancelQuery.Create( Application );
This form is created with the TApplication instance as owner. However,
accessing the Application instance is a big no-no in multi-threaded apps.
This sometimes causes my database thread to die a horrible death. I've
managed to easily get around the problem by assigning a dummy OnCallback
event handler to my TIB_Query components. This causes the TIB_Dataset
component not to create its own handler.
I suggest that in order to fix this problem (if it's not fixed yet) is to
add an additional property to the TIB_Dataset class which allows one to
Disable the callback functionality alltogether, perhaps something like
CallbackDisable. When set to true it should skip any Callback functionality.
This might make more sense than having to assign a dummy callback routine.
Regards,
Don Schoeman