Is this code line necessary?

BlitzMax Forums/BlitzMax GUI Programming/Is this code line necessary?

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)

It may be - the old toolbar will eventually freed, but it is not guaranteed to happen within a certain time period.

OK, thanks Michael.

From my experience such safety lines are necessary. :(

no

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!)