diff options
author | stanton <stanton> | 1999-02-04 20:56:15 (GMT) |
---|---|---|
committer | stanton <stanton> | 1999-02-04 20:56:15 (GMT) |
commit | e4a39867867a5e7241f1dc928fbef189a909847b (patch) | |
tree | 14a1d3068095532ded0272215ab345688e9ccf4a /generic/tkImgBmap.c | |
parent | fc354e0cac7be6f862321458e39278b50bf2daac (diff) | |
download | tk-e4a39867867a5e7241f1dc928fbef189a909847b.zip tk-e4a39867867a5e7241f1dc928fbef189a909847b.tar.gz tk-e4a39867867a5e7241f1dc928fbef189a909847b.tar.bz2 |
* generic/tkImgBmap.c (ImgBmapConfigureInstance): If an image
mask changed but ended up with the same XID, the GC failed to be
updated and so the new mask was not used. [Bug: 970]
Diffstat (limited to 'generic/tkImgBmap.c')
-rw-r--r-- | generic/tkImgBmap.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c index d3e9f41..d7be9de 100644 --- a/generic/tkImgBmap.c +++ b/generic/tkImgBmap.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkImgBmap.c,v 1.4 1998/09/14 18:23:12 stanton Exp $ + * RCS: @(#) $Id: tkImgBmap.c,v 1.5 1999/02/04 20:56:15 stanton Exp $ */ #include "tkInt.h" @@ -340,6 +340,7 @@ ImgBmapConfigureInstance(instancePtr) XGCValues gcValues; GC gc; unsigned int mask; + Pixmap oldMask; /* * For each of the options in masterPtr, translate the string @@ -382,10 +383,14 @@ ImgBmapConfigureInstance(instancePtr) (unsigned) masterPtr->height); } - if (instancePtr->mask != None) { - Tk_FreePixmap(Tk_Display(instancePtr->tkwin), instancePtr->mask); - instancePtr->mask = None; - } + /* + * Careful: We have to allocate a new mask Pixmap before deleting + * the old one. Otherwise, The XID allocator will always return + * the same XID for the new Pixmap as was used for the old Pixmap. + * And that will prevent the mask from changing in the GC below. + */ + oldMask = instancePtr->mask; + instancePtr->mask = None; if (masterPtr->maskData != NULL) { instancePtr->mask = XCreateBitmapFromData( Tk_Display(instancePtr->tkwin), @@ -393,6 +398,9 @@ ImgBmapConfigureInstance(instancePtr) masterPtr->maskData, (unsigned) masterPtr->width, (unsigned) masterPtr->height); } + if (oldMask != None) { + Tk_FreePixmap(Tk_Display(instancePtr->tkwin), oldMask); + } if (masterPtr->data != NULL) { gcValues.foreground = instancePtr->fg->pixel; |