Robert Purves a écrit : > > Alain Pastor wrote: > >> Bernie a écrit : >> >>> I'm curious. Is it advisable to dispose of the old icon after >>> setting the new one? >> >> I'm not sure it is necessary if the resource handle is not detached >> and the resource is made purgeable. > > > It is clear that you must dispose of a CIconHandle obtained with > GetCIcon. Apple says of GetCIcon: > "When you are finished with a handle obtained from this function, use > the DisposeCIcon function to release the memory occupied by the color > icon structure." > > And in relation to bevel button controls: > "Please keep in mind that resource-based content is owned by the > control, handle-based content is owned by you. The CDEF will not try to > dispose of handle-based content." > > Thanks Robert, However my doubts are not fully dissipated. What happens when you close such a control or the window to which it belongs? Do you have to dispose of the CIcon handle beforehand? I'm inclined to think this is not the case and I venture a built-in mechanism may be implemented at the Toolbox level. My doubts once again come from the interpretation of the term resource-based control in the second paragraph, because I believe that when you use GetCIcon you get a resource handle. I might be wrong though. Of course, if the CIconHandle is duplicated when setting the control data, I guess the DisposeCIcon call is in order after using the Def SetButtonData command. Alain