Menu

#85 Tk panic on exit when pixmap images have been created.

1.4.0
closed
None
1
2016-04-29
2016-04-28
No

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

Discussion

  • Brian Griffin

    Brian Griffin - 2016-04-28

    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);

      dataPtr->maskDC = maskDC;
      dataPtr->maskBm = maskBm;
      dataPtr->maskBmOld = maskBmOld;
      

      } else {
      dataPtr->maskDC = NULL;
      }
      + TkWinReleaseDrawableDC(instancePtr->pixmap, dc, &dcState);
      dataPtr->bitmapDC = bitmapDC;
      dataPtr->bitmap = bitmap;
      dataPtr->bitmapOld = bitmapOld;

     
  • Jan Nijtmans

    Jan Nijtmans - 2016-04-29
    • status: open --> closed
    • assigned_to: Jan Nijtmans
     
  • Jan Nijtmans

    Jan Nijtmans - 2016-04-29

    Fixed now. Thanks, Brian!

     

Log in to post a comment.