diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2006-02-27 10:36:08 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2006-02-27 10:36:08 (GMT) |
commit | eac8c8f015800262fd125ca163d63161dbb4eeb5 (patch) | |
tree | 9c158e31b94a9e1e62ac4c303664282c966e8847 | |
parent | 3e97de678ab8cbce3e00a0a396d89ea65ffc5b55 (diff) | |
download | tk-eac8c8f015800262fd125ca163d63161dbb4eeb5.zip tk-eac8c8f015800262fd125ca163d63161dbb4eeb5.tar.gz tk-eac8c8f015800262fd125ca163d63161dbb4eeb5.tar.bz2 |
Fix pixmap creation ordering issue [Bug 480862]
Stupid issue was fixed for the mask pixmap, but not the data pixmap!
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | generic/tkImgBmap.c | 34 |
2 files changed, 24 insertions, 16 deletions
@@ -1,3 +1,9 @@ +2006-02-27 Donal K. Fellows <donal.k.fellows@manchester.ac.uk> + + * generic/tkImgBmap.c (ImgBmapConfigureInstance): Force creation of + new Pixmaps before deletion of old ones to prevent stupid caching + problems. [Bug 480862] + 2006-02-09 Daniel Steffen <das@users.sourceforge.net> * generic/tk.decls: fix signature of TkMacOSXInvalClipRgns diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c index 26322c9..7b34f5d 100644 --- a/generic/tkImgBmap.c +++ b/generic/tkImgBmap.c @@ -10,7 +10,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.17 2005/11/15 15:18:21 dkf Exp $ + * RCS: @(#) $Id: tkImgBmap.c,v 1.18 2006/02/27 10:36:08 dkf Exp $ */ #include "tkInt.h" @@ -345,7 +345,7 @@ ImgBmapConfigureInstance( XGCValues gcValues; GC gc; unsigned int mask; - Pixmap oldMask; + Pixmap oldBitmap, oldMask; /* * For each of the options in masterPtr, translate the string form into an @@ -376,10 +376,18 @@ ImgBmapConfigureInstance( } instancePtr->fg = colorPtr; - if (instancePtr->bitmap != None) { - Tk_FreePixmap(Tk_Display(instancePtr->tkwin), instancePtr->bitmap); - instancePtr->bitmap = None; - } + /* + * Careful: We have to allocate new Pixmaps before deleting the old ones. + * Otherwise, The XID allocator will always return the same XID for the + * new Pixmaps as was used for the old Pixmaps. And that will prevent the + * data and/or mask from changing in the GC below. + */ + + oldBitmap = instancePtr->bitmap; + instancePtr->bitmap = None; + oldMask = instancePtr->mask; + instancePtr->mask = None; + if (masterPtr->data != NULL) { instancePtr->bitmap = XCreateBitmapFromData( Tk_Display(instancePtr->tkwin), @@ -387,16 +395,6 @@ ImgBmapConfigureInstance( masterPtr->data, (unsigned) masterPtr->width, (unsigned) masterPtr->height); } - - /* - * 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), @@ -404,9 +402,13 @@ ImgBmapConfigureInstance( masterPtr->maskData, (unsigned) masterPtr->width, (unsigned) masterPtr->height); } + if (oldMask != None) { Tk_FreePixmap(Tk_Display(instancePtr->tkwin), oldMask); } + if (oldBitmap != None) { + Tk_FreePixmap(Tk_Display(instancePtr->tkwin), oldBitmap); + } if (masterPtr->data != NULL) { gcValues.foreground = instancePtr->fg->pixel; |