Re: XForms: colormaps and canvases

T.C. Zhao (zhao@bloch.phys.uwm.edu)
Fri, 31 Oct 1997 23:19:04 -0600

To subscribers of the xforms list from "T.C. Zhao" <zhao@bloch.phys.uwm.edu> :

On Oct 31, 10:37am, Stephen Langer wrote:

> Last week I posted a question about whether it's possible to have
> two canvases share the same colormap, when that colormap is different
> from the one used by the rest of the forms. I got a few helpful suggestions
> about workarounds, but no real answer to the question.

Thanks for the test code. What you've suspected is true, that is,
when a canvas goes away, the colormap associated with it is freed.
This creates problems for applications that share
colormaps between different canvases. With the current
API, there is really no solution to this problem. If things
were done right, the set_colormap routine really should take
a pointer to a colormap. This way, when the colormap is freed,
the pointer is reset to null, effectively eliminating the possiblity
of multiple free attemps by other canvases. Obviously this is
not an acceptable solution as it breaks existing code. Another
solution, as you suggested, is to leave the colormap alone.
This certainly avoids the X error and does not break existing code,
but as spl pointed out, this may leak colormaps, a big no-no. The only
workable solution that I can think of is add another
routine so the user can indicate what the canvas should do with the
colormap, perhaps something like set_canvas_keep_colormap or
something like that.

_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/