Skip to content

Commit 6f35144

Browse files
committed
[[ Bug 22556 ]] Fix unpaired unlock of dragboard
This patch fixes an issue where `MCdragboard->Unlock()` was called when the drag leaves the window when `MCdragboard->Lock()` had not been called. The call to `Unlock()` has been changed to `PushUpdates()` so that the system dragboard is updated with the current data so that it can be dropped onto other applications etc. This change resolves an issue where after a number of drags from LiveCode to another application drag and drop no longer appears to function.
1 parent 0784d59 commit 6f35144

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

docs/notes/bugfix-22556.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Drag and drop on macOS from LiveCode to another application no longer fails after three drags

engine/src/clipboard.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ bool MCClipboard::Lock(bool p_skip_pull) const
7676

7777
bool MCClipboard::Unlock() const
7878
{
79+
MCAssert(m_lock_count > 0);
7980
// Decrement the lock count. If it moves from one to zero, push any changes
8081
// out to the underlying OS clipboard.
8182
//

engine/src/dispatch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1710,7 +1710,7 @@ void MCDispatch::wmdragleave(Window w)
17101710
}
17111711

17121712
// We are no longer the drop target and no longer care about the drag data.
1713-
MCdragboard->Unlock();
1713+
MCdragboard->PushUpdates();
17141714
MCdragboard->ReleaseData();
17151715
m_drag_target = false;
17161716
}

0 commit comments

Comments
 (0)