Board index » delphi » DataModule in a thread - "Invalid pointer operation" error

DataModule in a thread - "Invalid pointer operation" error

Hi,
I write a threded application with DataModule as thread private attribute
and with IBX 4.2 components (D5 Prof). The DataModule is created on the
begining of thread Execute method and is destroyed at the end of Execute
method. When DataModule is destroyed (MyDataModule.Free) program raises
error: "Invalid pointer operation".

Could anybody explain me this problem ? Is this the good approach ?
Also I used TMyDataModule.Free method before and after terminating the
thread and even within TMyThread.Destroy method. The error was the same.
The database connection uses 'localhost' address and remote server.

thanks
Adam

 

Re:DataModule in a thread - "Invalid pointer operation" error


Quote
> Hi,
> I write a threded application with DataModule as thread private attribute
> and with IBX 4.2 components (D5 Prof). The DataModule is created on the
> begining of thread Execute method and is destroyed at the end of Execute
> method. When DataModule is destroyed (MyDataModule.Free) program raises
> error: "Invalid pointer operation".

Try install IBX 4.41

Massimo

Re:DataModule in a thread - "Invalid pointer operation" error


I've just  resolved this problem.

The DataModule was destroyed in the TMainForm.Destroy destructor.
I moved the TMyDataModule.Free  method (within TMyThread.Destroy) to
TMainForm.Close and now all is ok.

Adam

Adam Baraniecki napisa3(a):

Quote
> Hi,
> I write a threded application with DataModule as thread private attribute
> and with IBX 4.2 components (D5 Prof). The DataModule is created on the
> begining of thread Execute method and is destroyed at the end of Execute
> method. When DataModule is destroyed (MyDataModule.Free) program raises
> error: "Invalid pointer operation".

> Could anybody explain me this problem ? Is this the good approach ?

> Also I used TMyDataModule.Free method before and after terminating the
> thread and even within TMyThread.Destroy method. The error was the same.
> The database connection uses 'localhost' address and remote server.

> thanks
> Adam

Other Threads