GNOME Bugzilla – Bug 786121
Crash when using OLE2 DnD
Last modified: 2018-05-02 18:50:31 UTC
How to reproduce: * Run gtk3-demo * Select IconView->Drag&Drop demo * Drag and drop iconview elements * Observe that everything works correctly * Run * GDK_WIN32_USE_EXPERIMENTAL_OLE2_DND=1 gtk3-demo * Select IconView->Drag&Drop demo * Try to drag iconview elements Expected result: * Doesn't crash Actual result: * Crashes with a message: Gdk:ERROR:gdkevents-win32.c:1760:_gdk_win32_end_modal_call: assertion failed: (_modal_operation_in_progress) What happens: My code for unrelated issue added handling for WM_CAPTURECHANGED. Turns out, this message is also sent during OLE2 DnD loop. My code cancels the modal operation in response to this message...and then the OLE2 DnD code tries to cancel it again, failing an assertion Proposed fix: The first thing that comes to my head is to differentiate between different modal operations (say, by changing the _modal_operation_in_progress variable from gboolean to an enum) and don't end DnD op on WM_CAPTURECHANGED.
Created attachment 357378 [details] [review] GDK W32: More flexible modal operation mode Instead of using a boolean to indicate a modal operation being in progress, use a set of flags, and allow these to be set and unset independently. Specifically, this allows WM_CAPTURECHANGED handler to only act when a drag-move or drag-resize modal operation is in progress, and ignore DND (which can also cause WM_CAPTURECHANGED to be posted). This avoids a crash due to assertion failure when OLE2 DND code tries to end a modal operation that was already ended by the WM_CAPTURECHANGED handler. This fixes the crash, but OLE2 DnD still seems to be broken (why - that's another matter entirely; i'm not sure whether any of the changes i've ever done contributed to that fact).
Review of attachment 357378 [details] [review]: Looks good to me. Just fix the comment pointed out. ::: gdk/win32/gdkprivate-win32.h @@ +345,3 @@ +typedef enum { + GDK_WIN32_MODAL_OP_NONE = 0x0, For consistency let's use 0, 0 << 1, 1 << 1 etc
Created attachment 360781 [details] [review] GDK W32: More flexible modal operation mode v2 v2: * Use bitshifts to define the op masks * Added a missing break statement
Review of attachment 360781 [details] [review]: Fine for me, see the comment though ::: gdk/win32/gdkprivate-win32.h @@ +350,3 @@ + GDK_WIN32_MODAL_OP_MENU = 0x1 << 2, + GDK_WIN32_MODAL_OP_DND = 0x1 << 3 +} GdkWin32ModalOpKind; I'd call it Flags intead of Kind for consistency, and do not use 0x,
Comment on attachment 360781 [details] [review] GDK W32: More flexible modal operation mode v2 Attachment 360781 [details] pushed as 87103b9 - GDK W32: More flexible modal operation mode
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk/issues/876.