Hi TheRealLoki thanks for the reply.
Before I get started on checking my classes and making changes I have a few questions....
I am actually creating a number of threads and custom classes, my threads are only overriding the Execute procedure so would I need to inherit the Destroy aswell to ensure a clean freeing up of the thread?
I have noticed that the threads don't inherit the Execute procedure in my Execute procedure,
e.g. inherited Execute;
Should I include this? I created my threads using the New option in Delphi and created a thread from there, it doesn't add this line by default.
My classes are declared as:
type
MyClass = class
.......
end
I am not declaring them as a type e.g. class(TObject), should I declare them as a type and then override the destroy and create? At the moment I am just creating them and freeing them like:
ClassName := TClassName.Create;
...and then to free
ClassName.Free;
Because I am declaring no type for the class and I am not overriding any Destroy procedure are my classes at the moment even getting destroyed??? could this be the cause of my problems?
Let me your thoughs on this and then I will get started on making any nessessary changes.
Thanks.
Main Topics
Browse All Topics





by: TheRealLokiPosted on 2007-11-01 at 20:20:15ID: 20198217
First thing I'd check is that the "inherited" objects all handle the Create and Destroy correctly.
s: string);
;
I'm referring to inherited and override.
eg.
type TMybaseObject = class(TObject)
public
sometext: string;
constructor Create(s: string); virtual
constructor Destroy; override;
..
end;
..
type tMyInheritedObject. = class(TMybaseObject)
public
constructor Create(s: string); override;
constructor Destroy; override;
..
end;
..
..
constructor TMybaseObject.Create(s: string);
begin
inherited Create;
sometext := s;
.. blah
end;
destructor TMybaseObject.Destroy;
begin
..blah
inherited Destroy;
end;
..
constructor tMyInheritedObject.Create(
begin
inherited Create(s);
.. blah
end;
constructor tMyInheritedObject.Destroy
begin
..blah
inherited Destroy;
end;
let me know if i'm on the wrong track here, it's just that not handling these correctly certainly causes weird Access violations in code that can be hard to spot.