Drawlist image question

This forum is for general developer support questions.
Post Reply
xenic
Posts: 1185
Joined: Sun Jun 19, 2011 12:06 am

Drawlist image question

Post by xenic »

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
User avatar
thomasrapp
Posts: 310
Joined: Sat Jun 18, 2011 11:22 pm

Re: Drawlist image question

Post by thomasrapp »

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.
xenic
Posts: 1185
Joined: Sun Jun 19, 2011 12:06 am

Re: Drawlist image question

Post by xenic »

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
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 600
Joined: Sat Jun 18, 2011 2:40 am
Location: Portsmouth, UK
Contact:

Re: Drawlist image question

Post by broadblues »

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: 600
Joined: Sat Jun 18, 2011 2:40 am
Location: Portsmouth, UK
Contact:

Re: Drawlist image question

Post by broadblues »

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...)
xenic
Posts: 1185
Joined: Sun Jun 19, 2011 12:06 am

Re: Drawlist image question

Post by xenic »

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
Post Reply