Img 1.4.2, Tk 8.6.5
Tk panics with "Unable to free colormap, palette is still selected" on exit when there has been any pixmap images created. This for Windows only. To reproduce:
package require Img
image create pixmap -data {/ XPM / {
"16 16 3 1",
". c #000000",
"@ c red",
"# c Black",
"................",
".##############.",
".##############.",
".##############.",
".##############.",
".##############.",
".#@@@@@@@@@@@@#.",
".#@@@@@@@@@@@@#.",
".#@@@@@@@@@@@@#.",
".#@@@@@@@@@@@@#.",
".##############.",
".##############.",
".##############.",
".##############.",
".##############.",
"................"};
}
set n 0
foreach i [image names] {
pack [label .l$n -image $i]
incr n
}
update
exit
This patch fixes the problem.
$ p4 diff -dc 'pixmapWin.c'
==== pixmapWin.c#1 - pixmapWin.c ====
202,214 *
BitBlt(bitmapDC, 0, 0, w, h, maskDC, 0, 0, SRCAND);
BitBlt(maskDC, 0, 0, w, h, maskDC, 0, 0, NOTSRCCOPY);
TkWinReleaseDrawableDC(instancePtr->pixmap, dc, &dcState);
dataPtr->maskDC = maskDC;
dataPtr->maskBm = maskBm;
dataPtr->maskBmOld = maskBmOld;
} else {
dataPtr->maskDC = NULL;
}
dataPtr->bitmapDC = bitmapDC;
dataPtr->bitmap = bitmap;
dataPtr->bitmapOld = bitmapOld;
--- 202,214 ----
BitBlt(bitmapDC, 0, 0, w, h, maskDC, 0, 0, SRCAND);
BitBlt(maskDC, 0, 0, w, h, maskDC, 0, 0, NOTSRCCOPY);
} else {
dataPtr->maskDC = NULL;
}
+ TkWinReleaseDrawableDC(instancePtr->pixmap, dc, &dcState);
dataPtr->bitmapDC = bitmapDC;
dataPtr->bitmap = bitmap;
dataPtr->bitmapOld = bitmapOld;
Fixed now. Thanks, Brian!