GNOME Bugzilla – Bug 552681
Negative pixmap widths with vertical notebook tabs on win32
Last modified: 2011-10-21 07:15:49 UTC
With GTK+ 2.14.1 installed from gtk-win.sourceforge.net, my program (compiled with mingw32 for win32) gives two warnings on Windows XP 32-bit: Gdk-WARNING **: gdkpixmap-win32.c:302: CreateDIBSection failed: The operation completed successfully. Gdk-WARNING **: gdkpixmap-win32.c:114: DeleteObject failed: The operation completed successfully. The first warning has this stack trace: (gdb) bt
+ Trace 206902
from C:\Program Files\GTK2-Runtime\lib\libgtk-win32-2.0-0.dll Cannot access memory at address 0x4000800a It then crashes with the following assertion failure: Gdk:ERROR:gdkgc-win32.c:768:get_impl_drawable: code should not be reached GtkNotebooks in (for example) gtk-demo run fine, and my application will display notebooks properly if the UI file is cut down a bit, but not this notebook (even if all its tabs' content is just replaced with one tab with a label in it).
Running the program with "--gdk-debug pixmaps", the following log appears: gdk_pixmap_new: 1x1x24 drawable=00C19010 ... =5E050C49 bits=00D50000 pixmap=00C12BC0 gdk_pixmap_new: 61x17x24 drawable=00CCC1A0 ... =06050D51 bits=00E70000 pixmap=00C12710 gdk_pixmap_impl_win32_finalize: 06050D51 gdk_pixmap_new: 12x21x24 drawable=00CCC200 ... =07050D51 bits=00E70000 pixmap=00C12E90 gdk_pixmap_impl_win32_finalize: 07050D51 gdk_pixmap_new: 57x17x24 drawable=00CCC320 ... =08050D51 bits=00E70000 pixmap=00C12D58 gdk_pixmap_impl_win32_finalize: 08050D51 gdk_pixmap_new: 12x21x24 drawable=00CCC380 ... =09050D51 bits=00E70000 pixmap=00C88108 gdk_pixmap_impl_win32_finalize: 09050D51 gdk_pixmap_new: 120x17x24 drawable=00CCC440 ... =0A050D51 bits=00E70000 pixmap=00C88180 gdk_pixmap_impl_win32_finalize: 0A050D51 gdk_pixmap_new: 762x19x24 drawable=00C19850 ... =0B050D51 bits=00E70000 pixmap=00C881E0 gdk_pixmap_impl_win32_finalize: 0B050D51 gdk_pixmap_new: 65x21x24 drawable=00CCC140 ... =0C050D51 bits=00E70000 pixmap=00C882B8 gdk_pixmap_impl_win32_finalize: 0C050D51 gdk_pixmap_new: 61x21x24 drawable=00CCC2C0 ... =0D050D51 bits=00E70000 pixmap=00C882B8 gdk_pixmap_impl_win32_finalize: 0D050D51 gdk_pixmap_new: 124x21x24 drawable=00CCC3E0 ... =0E050D51 bits=00E70000 pixmap=00C881E0 gdk_pixmap_impl_win32_finalize: 0E050D51 gdk_pixmap_new: 762x626x24 drawable=00C198B0 ... =0F050D51 bits=00E70000 pixmap=00C88180 gdk_pixmap_new: 1536x64x24 drawable=00C19010 ... =0A050D54 bits=01050000 pixmap=00C88450 gdk_pixmap_new: -337x45x24 drawable=00C198B0 ... =00000000 bits=00000000 pixmap=00C120E0 (mcus.exe:3992): Gdk-WARNING **: gdkpixmap-win32.c:302: CreateDIBSection The operation completed successfully. gdk_pixmap_impl_win32_finalize: 00000000 (mcus.exe:3992): Gdk-WARNING **: gdkpixmap-win32.c:114: DeleteObject fail operation completed successfully. ** Gdk:ERROR:gdkgc-win32.c:748:get_impl_drawable: code should not be reached Looks like the operation's failing due to a negative width for the pixmap. Perhaps a g_return_val_if_fail should be added to catch this case? In any case, I believe the GDI error code thrown by CreateDIBSection is getting overwritten by either the call to SelectPalette or ReleaseDC, which should be fixed.
After some prodding, it appears this is caused by me having a GtkNotebook with tab-pos = GTK_POS_LEFT, which messes up the pixbuf dimensions somehow. Leaving the property as the default prevents the crash.
s/pixbuf/pixmap/, sorry
Created attachment 132023 [details] Small program reproducing the crash. This program creates a GtkNotebook with tabs on the left and packs it in a way that causes a crash: inside a GtkExpander, inside a VBox with one other widget. The crash only happens on Windows with the MS-Windows theme, not the default theme. Variations that also crash are noted in the comments. This was tested with MinGW GCC 3.4.5 and GTK+ 2.16.0 from the all-in-one bundle on Windows XP SP3.
Here is some background on attachment id 132023. I'm a developer on the Nmap Security Scanner. One of our users reported a crash of our GUI, which uses PyGTK, under Windows. It seems to have the same underlying cause as this bug, as it crashes with the same "get_impl_drawable: code should not be reached" message. http://seclists.org/nmap-dev/2009/q2/0010.html The crash only happens on Windows with the MS-Windows theme. Conditions sufficient to cause it are: tab position set to GTK_POS_LEFT or GTK_POS_RIGHT, packed in a GtkFrame or GtkExpander, which is packed in a VBox with at least one other widget. The complete error output I get is (gtk-crash.exe:2184): Gdk-WARNING **: gdkpixmap-win32.c:302: CreateDIBSection failed: Not enough storage is available to process this command. (gtk-crash.exe:2184): Gdk-WARNING **: gdkpixmap-win32.c:114: DeleteObject failed: The system could not find the environment option that was entered. ** Gdk:ERROR:gdkgc-win32.c:748:get_impl_drawable: code should not be reached This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.
(In reply to comment #5) > The crash only happens on Windows with the MS-Windows theme. Conditions > sufficient to cause it are: tab position set to GTK_POS_LEFT or GTK_POS_RIGHT, > packed in a GtkFrame or GtkExpander, which is packed in a VBox with at least > one other widget. This is very interesting. GnuCash also has an open bug (bug 614636) for the exact same problem. I wasn't aware that this only happened with the Ms-Windows theme. I verified and indeed, using another theme fixes the crash. This bug still exists in 2.24 by the way.
*** This bug has been marked as a duplicate of bug 650300 ***