summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <dkf@noemail.net>2006-02-27 11:12:29 (GMT)
committerdkf <dkf@noemail.net>2006-02-27 11:12:29 (GMT)
commit316622e1b4524704c048988b0b31fbd8088fdd46 (patch)
treea806f6fd9a61392c924e8bb59bbfb87db4347d27
parenteba8027cd7d75c71ecb23672922450b569f7c45a (diff)
downloadtk-316622e1b4524704c048988b0b31fbd8088fdd46.zip
tk-316622e1b4524704c048988b0b31fbd8088fdd46.tar.gz
tk-316622e1b4524704c048988b0b31fbd8088fdd46.tar.bz2
Fix pixmap creation ordering issue [Bug 480862]
Stupid issue was fixed for the mask pixmap, but not the data pixmap! FossilOrigin-Name: 110a7e3d7fa530415f938159b3111fbfbbf0ea3d
-rw-r--r--ChangeLog6
-rw-r--r--generic/tkImgBmap.c38
2 files changed, 28 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 8716e8c..ff04b84 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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 d89663e..b4ae169 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.15 2002/08/05 04:30:39 dgp Exp $
+ * RCS: @(#) $Id: tkImgBmap.c,v 1.15.2.1 2006/02/27 11:12:29 dkf Exp $
*/
#include "tkInt.h"
@@ -356,7 +356,7 @@ ImgBmapConfigureInstance(instancePtr)
XGCValues gcValues;
GC gc;
unsigned int mask;
- Pixmap oldMask;
+ Pixmap oldBitmap, oldMask;
/*
* For each of the options in masterPtr, translate the string
@@ -387,10 +387,21 @@ ImgBmapConfigureInstance(instancePtr)
}
instancePtr->fg = colorPtr;
- if (instancePtr->bitmap != None) {
- Tk_FreePixmap(Tk_Display(instancePtr->tkwin), instancePtr->bitmap);
- instancePtr->bitmap = None;
- }
+ oldMask = instancePtr->mask;
+ instancePtr->mask = 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),
@@ -398,15 +409,6 @@ ImgBmapConfigureInstance(instancePtr)
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),
@@ -414,8 +416,12 @@ ImgBmapConfigureInstance(instancePtr)
masterPtr->maskData, (unsigned) masterPtr->width,
(unsigned) masterPtr->height);
}
+
if (oldMask != None) {
- Tk_FreePixmap(Tk_Display(instancePtr->tkwin), oldMask);
+ Tk_FreePixmap(Tk_Display(instancePtr->tkwin), oldMask);
+ }
+ if (oldBitmap != None) {
+ Tk_FreePixmap(Tk_Display(instancePtr->tkwin), oldBitmap);
}
if (masterPtr->data != NULL) {