[ANSWER = "No"] Share CHOOSER_Labels list?

This forum is for general developer support questions.
Post Reply
User avatar
gazelle
Posts: 102
Joined: Sun Mar 04, 2012 12:49 pm
Location: Frohnleiten, Austria

[ANSWER = "No"] Share CHOOSER_Labels list?

Post by gazelle »

Is it allowed to share a labellist for choosers? I didn't find anything in the docs. It works so far.

There also seems to be a bug with freeing the allocated nodes. According to the autodocs, the nodes should be freed on disposal.
CHOOSER_Labels (struct List *)
List of labels. Each node must be allocated with the AllocChooserNodeA() function. The list will be freed automatically when the object is disposed of.
But when I do (after DisposeObject() ):

Code: Select all

while ( (node = IExec->RemHead(list)) )
{
	IChooser->FreeChooserNode(node);
}
I get the full list of nodes and no memguard hit for freeing something twice.
Last edited by gazelle on Mon Feb 24, 2014 9:50 am, edited 3 times in total.
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 534
Joined: Sat Jun 18, 2011 4:12 pm
Location: Finland
Contact:

Re: Share CHOOSER_Labels list?

Post by salass00 »

That must be a mistake in the autodoc because the labels list is only freed automatically on DisposeObject() if it was created by the chooser class, that is if you used CHOOSER_LabelArray instead of CHOOSER_Labels.

I just fixed it in the SVN.
User avatar
gazelle
Posts: 102
Joined: Sun Mar 04, 2012 12:49 pm
Location: Frohnleiten, Austria

Re: Share CHOOSER_Labels list?

Post by gazelle »

Ok, thanks.

What about the real question to share the list for different choosers?
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 534
Joined: Sat Jun 18, 2011 4:12 pm
Location: Finland
Contact:

Re: Share CHOOSER_Labels list?

Post by salass00 »

gazelle wrote:Ok, thanks.

What about the real question to share the list for different choosers?
Well sharing the list shouldn't be a problem with the current chooser.gadget code at least.
User avatar
gazelle
Posts: 102
Joined: Sun Mar 04, 2012 12:49 pm
Location: Frohnleiten, Austria

Re: [ANSWERED] Share CHOOSER_Labels list?

Post by gazelle »

Thanks again. I can confirm that it works, no reaper so far (and I'm doing it since some days).
User avatar
ssolie
Beta Tester
Beta Tester
Posts: 1010
Joined: Mon Dec 20, 2010 8:51 pm
Location: Canada
Contact:

Re: [ANSWERED] Share CHOOSER_Labels list?

Post by ssolie »

gazelle wrote:Thanks again. I can confirm that it works, no reaper so far (and I'm doing it since some days).
Objects (lists, etc.) that you pass control over to a BOOPSI object should never be shared unless explicitly written otherwise. You are just asking for trouble.
ExecSG Team Lead
User avatar
gazelle
Posts: 102
Joined: Sun Mar 04, 2012 12:49 pm
Location: Frohnleiten, Austria

Re: [ANSWERED] Share CHOOSER_Labels list?

Post by gazelle »

ssolie wrote:Objects (lists, etc.) that you pass control over to a BOOPSI object should never be shared unless explicitly written otherwise. You are just asking for trouble.
That's what I feared, but it worked so well. Ok, time to restructure my code than.
Post Reply