Autor Beitrag
Masterrandy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55



BeitragVerfasst: Di 16.09.03 18:22 
Wie kann ich abfragen, ob ich ein bestimmtes objekt schon mit create erstellt habe?
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Di 16.09.03 18:24 
ausblenden Delphi-Quelltext
1:
if myobject <> nil then ...					

müsste eigendlich gehen !

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 16.09.03 18:25 
Auf nil testen oder Assigned benutzen. Vorsicht beide testen nir ob der Zeiger nil ist. Wird das Objekt mit Free frei gegeben existiret der Zeiger noch zeigt aber auf einen ungültigen Speicherbereich, das das Objekt schon entfernt wurde Free den Zeiger aber nicht "nillt".
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Mi 17.09.03 19:08 
und wie kann man das lösen ? also wie kann man den zeiger löschen ?

_________________
In the beginning was the word.
And the word was content-type: text/plain.
UC-Chewie
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 531

WinXP
D5 Ent
BeitragVerfasst: Mi 17.09.03 22:26 
So:
ausblenden Delphi-Quelltext
1:
2:
Object.Free;
Object := nil;


Oder:
ausblenden Delphi-Quelltext
1:
FreeAndNil(Object);					

_________________
Egal wie dumm man selbst ist, es gibt immer andere, die noch dümmer sind