Page 1 of 1

Drawlist image question

Posted: Tue Jan 16, 2018 3:53 am
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?

Re: Drawlist image question

Posted: Tue Jan 16, 2018 9:05 am
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.

Re: Drawlist image question

Posted: Tue Jan 16, 2018 5:09 pm
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.

Re: Drawlist image question

Posted: Tue Jan 16, 2018 7:36 pm
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.

Re: Drawlist image question

Posted: Tue Jan 16, 2018 7:37 pm
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...)

Re: Drawlist image question

Posted: Wed Jan 17, 2018 5:13 pm
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.