GNOME Bugzilla – Bug 378158
gdk_win32_selection_add_targets uses uninitialized hwnd variable
Last modified: 2008-06-15 00:03:03 UTC
gtk+/gdk/gdkselection-win32.c : gdk_win32_selection_add_targets If owner == NULL, then OpenClipboard is called with an uninitialized hwnd variable. I do not know how and where to fix it though. See attached test case for a quick way to see the warning gdk spits out because of the failed OpenClipboard API call. GnuCash uses gtkhtml to create its reports, but in gtkhtml/src/gtkhtml.c:gtk_html_init gtk_selection_add_targets is called with widget->window probably being NULL. GnuCash used to crash "immediately" after this warning, but I did not manage to debug that so it may be independent of this bug.
Created attachment 77029 [details] test snippet
Created attachment 112757 [details] [review] Set hwnd = NULL initially I think this is all we need to fix this. At least, I no longer get any warnings on the console with your test program when I use this.
2008-06-14 Cody Russell <bratsche@gnome.org> * gdk/win32/gdkselection-win32.c (gdk_win32_selection_add_targets): Initialize hwnd to NULL. This fixes OpenClipboard() failure and, according to MSDN docs, associates the open clipboard with the current task. (#378158, reported by Andreas Köhler)