Program crash when closing a form
Hello. I have a problem.
In my program I have 2 Form. One is MainForm where i have Table-component and Datasource-component. In this Form I can make new data records.
Second Form is ChildForm where I have Query-component and Edit label where i can write sql-sentences.
Now in childForm when i write example select *from Table1. Everything is working. data comes.
BUT. When i close this ChildForm I get error:
Access violation at address 00456B7D in module project1.exe'. Read of address 000002CC
My Close-button code are:
Query1->Close();
child->Close();
And In my childForm OnCLose event are
Action = caFree;
I'm absolutely lost. Please Help.
[754 byte] By [
Narri] at [2007-11-11 7:53:59]

# 1 Re: Program crash when closing a form
Are any thread still running that needed something in the form's memory space? Is there a destructor being called that releases some memory? If not, then you will have to step through the program and see *what* memory location is being read. Someone out there is trying to get at a variable that is destroyed.
jonnin at 2007-11-11 21:01:42 >

# 2 Re: Program crash when closing a form
yeah, check your mainForm code and make sure in your code you check that the childForm exists before trying to access it.
# 3 Re: Program crash when closing a form
Ok. I found out where problem comes but I have still problems.
If I add my childForm in the Auto-create forms box (Project->Option->Forms). Then I can close ChildForm. But now when I open my program the childForm is already open and I dont want that so I try to put code in MainForms Oncreate box:
childForm->Close();
but i get error when I start my program.
Ok. Now I can Close my childForm BUT if I write sql-sentence in childFOrm and THEN close form I get an error?.
So I try to tell:
if I add my ChildForm in Auto-create forms box I can close ChildForm if I dont write sql-sentences.
Narri at 2007-11-11 21:03:46 >
