After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 378158 - gdk_win32_selection_add_targets uses uninitialized hwnd variable
gdk_win32_selection_add_targets uses uninitialized hwnd variable
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: X11
2.10.x
Other Windows
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2006-11-22 15:59 UTC by Andreas Köhler
Modified: 2008-06-15 00:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test snippet (375 bytes, text/plain)
2006-11-22 16:01 UTC, Andreas Köhler
  Details
Set hwnd = NULL initially (393 bytes, patch)
2008-06-14 23:55 UTC, Cody Russell
committed Details | Review

Description Andreas Köhler 2006-11-22 15:59:52 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.
Comment 1 Andreas Köhler 2006-11-22 16:01:51 UTC
Created attachment 77029 [details]
test snippet
Comment 2 Cody Russell 2008-06-14 23:55:16 UTC
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.
Comment 3 Cody Russell 2008-06-15 00:00:56 UTC
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)