Classes and lists

3 posts / 0 new
Last post
mritter0
mritter0's picture
Offline
Last seen: 2 years 5 months ago
Joined: 2014-04-21 21:15
Classes and lists

I recently updated my gadgets to this style

  1. LAYOUT_AddChild, Objects[GAD_DETAILS1]=IIntuition->NewObject(ButtonClass,NULL,
  2. .....
  3. TAG_DONE),

instead of

  1. LAYOUT_AddChild, Objects[GAD_DETAILS1]=IIntuition->NewObject(NULL,"button.gadget",
  2. .....
  3. TAG_DONE),

The window opens just fine the first time.

When I close the window (all objects freed) and reopen it, when creating the gadgets it now crashes at any gadget that has a list attached to it: Choosers, ClickTab, ListBrowser.

It is like the gadget class is freeing my list so when I remake the gadget the list is invalid so it crashes. If I comment out the line for the list, it does not crash.

So, is the gadget class now freeing my lists? It didn't before. I don't want it to. The lists are static.

LyleHaze
LyleHaze's picture
Offline
Last seen: 2 years 2 weeks ago
Joined: 2011-05-26 03:58
Re: Classes and lists

Do you remove everything from the lists before closing?
Since a listbrowser list has to be removed before any changes are made, it's not much of a stretch to think that you might want to remove your list elements before freeing the window (and it's contents)

LyleHaze

thomas
thomas's picture
Offline
Last seen: 3 months 1 week ago
Joined: 2011-05-16 14:23
Re: Classes and lists

Classes won't touch the list during dispose. Lists can easily be reused. Some classes even support sharing of lists.

Log in or register to post comments