diff --git a/platform.d b/platform.d index 6d0986b..bf00ee1 100644 --- a/platform.d +++ b/platform.d @@ -973,6 +973,9 @@ GetClipboardSelection(PlatformWindow* w, Selection* sel) void RetrieveSelection(PlatformWindow* w, xcb_selection_notify_event_t* ev) { + Lock(&w.cb_mut); + scope(exit) Unlock(&w.cb_mut); + u8[] buf; u64 buf_size; u64 bytes_after = 1; @@ -1032,8 +1035,6 @@ RetrieveSelection(PlatformWindow* w, xcb_selection_notify_event_t* ev) if(buf != null) { - Lock(&w.cb_mut); - Selection* sel; foreach(i; CBM.min .. CBM.max) { @@ -1054,8 +1055,6 @@ RetrieveSelection(PlatformWindow* w, xcb_selection_notify_event_t* ev) { Errf("RetrieveSelection failure: mismatched selection actual_type: %s", actual_type); } - - Unlock(&w.cb_mut); } else {