Is this code line necessary?

BlitzMax Forums/MaxGUI Module/Is this code line necessary?

DavidDC(Posted 2007) [#1]
I'm still a little confused about BMax memory management generally.

Do I need the "Safety" line below?

' Safety
If Self.Toolbar <> Null FreeGadget(Self.Toolbar)

' Create the Toolbar
Self.ToolBar = CreateToolBar(s_icon_file, x,y,w,h,Self.Window)


Michael Reitzenstein(Posted 2007) [#2]
It may be - the old toolbar will eventually freed, but it is not guaranteed to happen within a certain time period.


DavidDC(Posted 2007) [#3]
OK, thanks Michael.


Grisu(Posted 2007) [#4]
From my experience such safety lines are necessary. :(


H&K(Posted 2007) [#5]
no


Chris C(Posted 2007) [#6]
I thought Tgadget didnt self dispose, ie you could make a window in a function assigning it to a local var an it wouldnt be destroyed on return...
(never liked this behaviour!)