Skip to content

Commit

Permalink
get_data_from_selection_owner() needs m_lock mutex locked
Browse files Browse the repository at this point in the history
  • Loading branch information
dacap committed Apr 13, 2021
1 parent 1b68bb3 commit a65a9e5
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions clip_x11.cpp
Expand Up @@ -121,13 +121,17 @@ class Manager {
// is a clipboard manager available were we can leave our data.
xcb_atom_t x11_clipboard_manager = get_atom(CLIPBOARD_MANAGER);
if (x11_clipboard_manager) {
// Start the SAVE_TARGETS mechanism so the X11
// CLIPBOARD_MANAGER will save our clipboard data
// from now on.
get_data_from_selection_owner(
{ get_atom(SAVE_TARGETS) },
[this]() -> bool { return true; },
x11_clipboard_manager);
// We have to lock the m_lock mutex that will be used to wait
// the m_cv condition in get_data_from_selection_owner().
if (try_lock()) {
// Start the SAVE_TARGETS mechanism so the X11
// CLIPBOARD_MANAGER will save our clipboard data
// from now on.
get_data_from_selection_owner(
{ get_atom(SAVE_TARGETS) },
[this]() -> bool { return true; },
x11_clipboard_manager);
}
}
}
#endif
Expand Down

0 comments on commit a65a9e5

Please sign in to comment.