[Gambas-devel] How to know if an object is allocated or freed ?

Laurent Carlier lordheavy at ...141...
Tue Dec 14 22:16:12 CET 2004


How can i know if an object was freed ?

GB.CheckObject test only if it's null.
It's should be good for me to avoid segfault.

code :
PUBLIC SUB Main()

  DIM toto AS Buffer
  
  Screen(800,600,32)
  toto = NEW Buffer(800,600,32)
 
  Draw.Buffer(toto)
  toto = Screen.Grab()
  Draw.Line(0,0,100,100)
  WAIT 3
    
END

it segfault as toto has been freed but isn't a null object !
How can i know if it was freed ?
Perhaps an int GB.IsAllocated(void** object) function should be usefull.

Regards,

-- 

Laurent Carlier




More information about the Devel mailing list