Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-10-28 01:29:00 +0300
committerCampbell Barton <campbell@blender.org>2022-10-28 01:32:03 +0300
commitb544d989d1535705cfd77312829bf6d09394ea5f (patch)
treebccfb0af10851b2f77bf21e2c4ff8c729ef516f1 /intern
parent454dd3f7f0a30837c58cece3740754e2fdd7a6c4 (diff)
GHOST/Wayland: unlock clipboard mutex on failure
When the Wayland pipe can't be opened, don't leave the mutex locked. Also skip checking wl_data_device_manager when reading from the primary clipboard.
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/intern/GHOST_SystemWayland.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp
index 0f609395124..36894807e73 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -1681,6 +1681,9 @@ static const char *read_buffer_from_data_offer(GWL_DataOffer *data_offer,
int pipefd[2];
if (UNLIKELY(pipe(pipefd) != 0)) {
CLOG_WARN(LOG, "error creating pipe: %s", std::strerror(errno));
+ if (mutex) {
+ mutex->unlock();
+ }
return nullptr;
}
wl_data_offer_receive(data_offer->id, mime_receive, pipefd[1]);
@@ -1707,6 +1710,9 @@ static const char *read_buffer_from_primary_selection_offer(
int pipefd[2];
if (UNLIKELY(pipe(pipefd) != 0)) {
CLOG_WARN(LOG, "error creating pipe: %s", std::strerror(errno));
+ if (mutex) {
+ mutex->unlock();
+ }
return nullptr;
}
zwp_primary_selection_offer_v1_receive(data_offer->id, mime_receive, pipefd[1]);
@@ -5114,6 +5120,9 @@ static void system_clipboard_put_primary_selection(GWL_Display *display, const c
static void system_clipboard_put(GWL_Display *display, const char *buffer)
{
+ if (!display->wl_data_device_manager) {
+ return;
+ }
GWL_Seat *seat = display->seats[0];
std::lock_guard lock{seat->data_source_mutex};
@@ -5140,7 +5149,7 @@ static void system_clipboard_put(GWL_Display *display, const char *buffer)
void GHOST_SystemWayland::putClipboard(const char *buffer, bool selection) const
{
- if (UNLIKELY(!display_->wl_data_device_manager || display_->seats.empty())) {
+ if (UNLIKELY(display_->seats.empty())) {
return;
}