Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 5 of 5 total |
AV when Session closed |
Mon, Mar 8 2010 1:15 AM | Permanent Link |
Peter | Hi there
Delphi 7 & EDB 2.03 build 8. I have a problem in closing the Engine that lives in a data module of my app. I thought it reasonable to Close the engine in the OnDestroy method of the DataModule, but it gives a resounding AV when I try it. The code is procedure TDModule.DataModuleDestroy(Sender: TObject); var i: integer; begin for i := 0 to EDBDatabase1.DataSetCount-1 do EDBDatabase1.Datasets[i].Close; for i := 0 to EDBDatabase2.DataSetCount-1 do EDBDatabase2.Datasets[i].Close; for i := 0 to EDBSession1.DatabaseCount - 1 do EDBSession1.Databases[i].Close; // wasn't closing Configuration database EDBSession1.DropConnections; EDBSession1.Close; // AV here, or if I rem this line, the AV on next line EDBEngine1.Close; end; I had been simply calling the EDBEngine1.Close, and letting it worry about the other components downstream, but I added the other lines when the AV started. This happens after a long migration & database creation process, so I must be destroying something that the Session expects to find, but I cannot see what. The call stack shows SetConnected after TEDBSession.Destroy, but I don't have the sorce so I can only assume that that is the way it should be: Access violation at address 005E414B in module 'Ver8NewData.exe'. Read of address 00000000. TEDBSession.InternalDisconnect TEDBSession.SetConnected TEDBSession.Destroy TComponent.DestroyComponents TComponent.Destroy TDataModule.Destroy TComponent.DestroyComponents DoneApplication DoExitProc @Halt0 initialization I tried closing the Engine in the form that calls the DataModule - same AV. Have you any suggestions as to where I should look? It must be something belonging to the Session, but what? Regards, Peter |
Mon, Mar 8 2010 7:57 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Peter,
<< I have a problem in closing the Engine that lives in a data module of my app. I thought it reasonable to Close the engine in the OnDestroy method of the DataModule, but it gives a resounding AV when I try it. >> How is the application being terminated ? There's an issue with using Halt to terminate an application: http://www.elevatesoft.com/forums?action=view&category=edb&id=edb_general&page=1&msg=7491#7491 If not that, then there is most likely something amiss with the destruction order of the units. -- Tim Young Elevate Software www.elevatesoft.com |
Mon, Mar 8 2010 8:07 AM | Permanent Link |
Peter | Tim
I don't use Halt anywhere. <<If not that, then there is most likely something amiss with the destruction order of the units.>> It would appear so, but as they are components in a DataModule, how can I control their destruction? I tried closing the Engine in the form that calls the DataModule, but that caused an AV, then I moved the Engine.Close to the DataModule's OnDestroy method - same sequence of events in the stack. Is there a way I can control the destruction? The AV appears to be in TEDBSession.InternalDisconnec, and I agree with your statement in the 'Halt problem' thread, in that "That causes the EDB components to try and shut down when some of the resources of the engine have already been destroyed.", which is what I am experiencing. I just can't see which resources I'm whacking. Thanks, Peter |
Mon, Mar 8 2010 9:08 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Peter
I've had similar (not the same but close) problems before and it came down to components the tables were connected to and events. I had to introduce a global variable AppClosing to detect what was going on and exit some events. Roy Lambert [Team Elevate] |
Mon, Mar 8 2010 4:53 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Peter,
<< It would appear so, but as they are components in a DataModule, how can I control their destruction? >> You shouldn't have to. Can you send me your data module that causes this problem ? I can pop it into a test application here and see what the issue is. I suspect that the issue is the component creation order on the data module, and that the data module is trying to free the engine component before the session component, or something similar. -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Tuesday, April 30, 2024 at 03:55 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |