BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

What's missing?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (dbExpress)
View previous topic :: View next topic  
Author Message
ZA
Guest





PostPosted: Mon Nov 10, 2003 5:18 pm    Post subject: What's missing? Reply with quote




Simple application: connects to MYSQL using TSQLConnection (in a datamodule
instance creating on the fly), using
TSQLDataSet/TDataSetProvider/TClientDataSet
amends the tables and everythings get posted fine. On FreeAndNil() this
DataModule raises AV in 'DBExpMySQL.dll', there is no code
on datamodule close/destroy event.

What could it be?

I tried to set .Connection property of TSQLConnection false on destroy
event, this is where AV occurs.

regards


Back to top
Eduardo Bahiense
Guest





PostPosted: Mon Nov 10, 2003 6:54 pm    Post subject: Re: What's missing? Reply with quote



Quote:
I tried to set .Connection property of TSQLConnection false on destroy
event, this is where AV occurs.

TSQLConnection is beeing freed before Datamodule.OnDestroy is Fired.
I guess TSQLConnection will automatically disconnect when freed, but ioy can
Disconnect it before destroying DataModule.

HTH Eduardo
Quote:
I tried to set .Connection property of TSQLConnection false on destroy
event, this is where AV occurs.

TSQLConnection is beeing freed before Datamodule.OnDestroy is Fired.
I guess TSQLConnection will automatically disconnect when freed, but ioy can
Disconnect it before destroying DataModule.

HTH Eduardo



Back to top
ZA
Guest





PostPosted: Tue Nov 11, 2003 10:05 am    Post subject: Re: What's missing? Reply with quote



Thanks,

But any approach raises AV.
1. Removed the code from OnDestroy Event of DM
2. Added a public procedure to set Connected property of TSQLConnection :=
False and calling it from within main routin before FreeAndNil(DM) method.

Anything else would be missing?

regards


"Eduardo Bahiense" <eduardo (AT) fdv (DOT) com.br> wrote

Quote:
I tried to set .Connection property of TSQLConnection false on destroy
event, this is where AV occurs.

TSQLConnection is beeing freed before Datamodule.OnDestroy is Fired.
I guess TSQLConnection will automatically disconnect when freed, but ioy
can
Disconnect it before destroying DataModule.

HTH Eduardo
I tried to set .Connection property of TSQLConnection false on destroy
event, this is where AV occurs.

TSQLConnection is beeing freed before Datamodule.OnDestroy is Fired.
I guess TSQLConnection will automatically disconnect when freed, but ioy
can
Disconnect it before destroying DataModule.

HTH Eduardo





Back to top
Eduardo Bahiense
Guest





PostPosted: Tue Nov 11, 2003 10:26 am    Post subject: Re: What's missing? Reply with quote

Quote:
Thanks,

But any approach raises AV.
1. Removed the code from OnDestroy Event of DM
2. Added a public procedure to set Connected property of TSQLConnection :=
False and calling it from within main routin before FreeAndNil(DM) method.

Anything else would be missing?


How are you creating DM? (Application.CreateForm? -
Datamodule.Create(someowner)?

if you are creating with owner <> nil then you don't need to destroy it.
Owner will do the trick. In this case, it's possible that you are trying to
FreeAndNil something that no longer exists.

Regards, Eduardo


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ([url]http://www.grisoft.com)[/url].
Version: 6.0.537 / Virus Database: 332 - Release Date: 06/11/2003



Back to top
ZA
Guest





PostPosted: Tue Nov 11, 2003 12:04 pm    Post subject: Re: What's missing? Reply with quote

The DM is created from a .pas file with no .dfm, therefore nil is passed as
owner param. I found out that FreeAndNil(DM) does not raise AV, its
TSQLConneciton.Connected property when set to False.
The sequence of events in the application:
1. The application creates DM
2. TSQLConnection is activated //(no probs)
3. The app. creates Tables //(no probs)
4. The app. imports records from text files //(no probs)
5. The app. release DM (FreeAndNil()) //(problem)

regarads

"Eduardo Bahiense" <eduardo (AT) fdv (DOT) com.br> wrote

Quote:
Thanks,

But any approach raises AV.
1. Removed the code from OnDestroy Event of DM
2. Added a public procedure to set Connected property of TSQLConnection
:=
False and calling it from within main routin before FreeAndNil(DM)
method.

Anything else would be missing?


How are you creating DM? (Application.CreateForm? -
Datamodule.Create(someowner)?

if you are creating with owner <> nil then you don't need to destroy it.
Owner will do the trick. In this case, it's possible that you are trying
to
FreeAndNil something that no longer exists.

Regards, Eduardo


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ([url]http://www.grisoft.com)[/url].
Version: 6.0.537 / Virus Database: 332 - Release Date: 06/11/2003





Back to top
Eduardo Bahiense
Guest





PostPosted: Tue Nov 11, 2003 12:45 pm    Post subject: Re: What's missing? Reply with quote

Quote:
The DM is created from a .pas file with no .dfm, therefore nil is passed
as
owner param. I found out that FreeAndNil(DM) does not raise AV, its
TSQLConneciton.Connected property when set to False.
The sequence of events in the application:
1. The application creates DM
2. TSQLConnection is activated //(no probs)
3. The app. creates Tables //(no probs)
4. The app. imports records from text files //(no probs)
5. The app. release DM (FreeAndNil()) //(problem)

Just trying to Help

May some DataSet connected to SQLConnection be trying to disconnect and
SQLConnection no longer exists?
Could you make sure all Data Components are Active False before Free DM?




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ([url]http://www.grisoft.com)[/url].
Version: 6.0.537 / Virus Database: 332 - Release Date: 06/11/2003



Back to top
ZA
Guest





PostPosted: Tue Nov 11, 2003 1:04 pm    Post subject: Re: What's missing? Reply with quote

Thanks mate, I'll keep trying with other test projects.

regards

"Eduardo Bahiense" <eduardo (AT) fdv (DOT) com.br> wrote

Quote:
The DM is created from a .pas file with no .dfm, therefore nil is passed
as
owner param. I found out that FreeAndNil(DM) does not raise AV, its
TSQLConneciton.Connected property when set to False.
The sequence of events in the application:
1. The application creates DM
2. TSQLConnection is activated //(no probs)
3. The app. creates Tables //(no probs)
4. The app. imports records from text files //(no probs)
5. The app. release DM (FreeAndNil()) //(problem)

Just trying to Help

May some DataSet connected to SQLConnection be trying to disconnect and
SQLConnection no longer exists?
Could you make sure all Data Components are Active False before Free DM?




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ([url]http://www.grisoft.com)[/url].
Version: 6.0.537 / Virus Database: 332 - Release Date: 06/11/2003





Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (dbExpress) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.