Subject | AV Problem |
---|---|
Author | Lee Jenkins |
Post date | 2003-12-08T04:47:15Z |
D6/IBO/Intraweb
I'm using IBO with an Intraweb application and I am having problems with
a consistent AV. The AV happens at the line:
"TIB_Component( ACmp ).CheckSession( AllowDefault );" in the code
snippet below of the IB_Components.pas:
procedure GrabSession( const ACmp: TComponent );
begin
if ACmp is TIB_Session then
ASession := TIB_Session( ACmp )
else
if ( ACmp <> Self ) and
( ACmp is TIB_Component ) then
begin
TIB_Component( ACmp ).CheckSession( AllowDefault ); // <==== AV
ASession := TIB_Component( ACmp ).FIB_Session;
end;
end;
The IBODatabase is created when the UserSession is created which as like
a datamodule specific to the session (thread), but I see that the above
proc is called 9 times before the session is even created, when the
application starts up. During the session, I create IBODatasets and
IB_Transactions in code, use them, commit the trans and free both. I
can do this as many times as I like until the session is closed and the
following code is called:
If IBDB.Connected Then
IBDB.Disconnect;
...in the Destroy event of the Session.
However, the very next time that the "GrabSession" proc is called, I get
an AV at the line indicated above. I must not understand correctly how
IBO works because I can't see the reason for this. Each UserSession
contains its own IBODatabase and each UserSession is created in the
context of a thread. The connection is closed when the session ends.
However, the code above looks like its looking for some kind of session
object that is global within the application?
Should I be using separate IBODatabases for each session? I assumed it
was like IBX where to be threadsafe, you need to create a separate
IBDatabase component for each thread (or using some kind of pooling
mechanism).
Any help would be appreciated. :)
--
Warm Regards,
Lee
I'm using IBO with an Intraweb application and I am having problems with
a consistent AV. The AV happens at the line:
"TIB_Component( ACmp ).CheckSession( AllowDefault );" in the code
snippet below of the IB_Components.pas:
procedure GrabSession( const ACmp: TComponent );
begin
if ACmp is TIB_Session then
ASession := TIB_Session( ACmp )
else
if ( ACmp <> Self ) and
( ACmp is TIB_Component ) then
begin
TIB_Component( ACmp ).CheckSession( AllowDefault ); // <==== AV
ASession := TIB_Component( ACmp ).FIB_Session;
end;
end;
The IBODatabase is created when the UserSession is created which as like
a datamodule specific to the session (thread), but I see that the above
proc is called 9 times before the session is even created, when the
application starts up. During the session, I create IBODatasets and
IB_Transactions in code, use them, commit the trans and free both. I
can do this as many times as I like until the session is closed and the
following code is called:
If IBDB.Connected Then
IBDB.Disconnect;
...in the Destroy event of the Session.
However, the very next time that the "GrabSession" proc is called, I get
an AV at the line indicated above. I must not understand correctly how
IBO works because I can't see the reason for this. Each UserSession
contains its own IBODatabase and each UserSession is created in the
context of a thread. The connection is closed when the session ends.
However, the code above looks like its looking for some kind of session
object that is global within the application?
Should I be using separate IBODatabases for each session? I assumed it
was like IBX where to be threadsafe, you need to create a separate
IBDatabase component for each thread (or using some kind of pooling
mechanism).
Any help would be appreciated. :)
--
Warm Regards,
Lee