Drawlist image question

This forum is for general developer support questions.

Drawlist image question

Postby xenic » Tue Jan 16, 2018 4:53 am

I'm using a drawlist image in a button gadget and it is added and removed as needed. Is a drawlist image an image that is added to the button bitmap or just instructions to draw into the buttons bitmap? Since my program can end without the drawlist image added to the button, do I need to dispose of it somehow?
AmigaOne X1000 with 2GB memory - OS4.1 FE
xenic
 
Posts: 1146
Joined: Sun Jun 19, 2011 1:06 am

Re: Drawlist image question

Postby thomasrapp » Tue Jan 16, 2018 10:05 am

A button does not have a bitmap. It only calls the IM_DRAW method of the image object and the image draws itself.

An object which is not attached to any other object which automatically disposes its children has to be disposed of manually. Use IIntuition->DisposeObject for that.
User avatar
thomasrapp
 
Posts: 256
Joined: Sun Jun 19, 2011 12:22 am

Re: Drawlist image question

Postby xenic » Tue Jan 16, 2018 6:09 pm

thomasrapp wrote:A button does not have a bitmap. It only calls the IM_DRAW method of the image object and the image draws itself.

An object which is not attached to any other object which automatically disposes its children has to be disposed of manually. Use IIntuition->DisposeObject for that.

Pardon my misuse of "bitmap" but I still have questions about the disposal of a drawlist object. The drawlist_ic.doc doesn't list any OM_DISPOSE method, which made me wonder if it actually needs to be disposed. My drawlist image is added to any or all of 50 buttons via SetGadgetAttrs(). Since the program isn't crashing when closed with the drawlist image in multiple gadgets, I'm assuming that Intuition protects against disposing of an object multiple times and it will be safe for me to dispose of the drawlist image object after disposing of the window object.
AmigaOne X1000 with 2GB memory - OS4.1 FE
xenic
 
Posts: 1146
Joined: Sun Jun 19, 2011 1:06 am

Re: Drawlist image question

Postby broadblues » Tue Jan 16, 2018 8:36 pm

Button.gadget does not dispose of the image passeed to via BUTTON_RenderImage et al so you need to dispose of the drawlist image, other you will leak memory, albeit not very much :-)

In terms of the autodoc not mention OM_DISPOSE, it's covered by the catch all at the end of the methods section: All other methods are passed to the superclass.
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 538
Joined: Sat Jun 18, 2011 3:40 am
Location: Portsmouth, UK

Re: Drawlist image question

Postby broadblues » Tue Jan 16, 2018 8:37 pm

I'm assuming that Intuition protects against disposing of an object multiple times


There is no protection agaist this at all, so if an object gets disposed of twice you will know about it (GR if you are lucky, more likely system lockup...)
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 538
Joined: Sat Jun 18, 2011 3:40 am
Location: Portsmouth, UK

Re: Drawlist image question

Postby xenic » Wed Jan 17, 2018 6:13 pm

broadblues wrote:
I'm assuming that Intuition protects against disposing of an object multiple times


There is no protection agaist this at all, so if an object gets disposed of twice you will know about it (GR if you are lucky, more likely system lockup...)


O.K. Thanks for the help.
AmigaOne X1000 with 2GB memory - OS4.1 FE
xenic
 
Posts: 1146
Joined: Sun Jun 19, 2011 1:06 am


Return to General Developer Support

Who is online

Users browsing this forum: No registered users and 4 guests