summaryrefslogtreecommitdiff
path: root/WindowServer/WSWindow.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-02-05 08:32:32 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-02-05 08:32:32 +0100
commit0c38a4c30f147c9f3fa605b00a861df047ad1270 (patch)
tree1a227fc5565ca6e21504f6ad272895e5bec8033d /WindowServer/WSWindow.cpp
parentca16d9d98e7d0e516cc014ea268a921a8c460ed0 (diff)
downloadserenity-0c38a4c30f147c9f3fa605b00a861df047ad1270.zip
WindowServer: Sever the WSWindow/Process link when the process dies.
This fixes a deadlock where the WindowServer would get stuck trying to acquire a dead process's event stream lock.
Diffstat (limited to 'WindowServer/WSWindow.cpp')
-rw-r--r--WindowServer/WSWindow.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/WindowServer/WSWindow.cpp b/WindowServer/WSWindow.cpp
index dfaebea425..8b6414c8ec 100644
--- a/WindowServer/WSWindow.cpp
+++ b/WindowServer/WSWindow.cpp
@@ -5,7 +5,7 @@
#include "Process.h"
WSWindow::WSWindow(Process& process, int window_id)
- : m_process(process)
+ : m_process(&process)
, m_window_id(window_id)
, m_pid(process.pid())
{
@@ -34,11 +34,13 @@ void WSWindow::set_rect(const Rect& rect)
Rect old_rect;
{
WSWindowLocker locker(*this);
+ if (!m_process)
+ return;
if (m_rect == rect)
return;
old_rect = m_rect;
m_rect = rect;
- m_backing = GraphicsBitmap::create(m_process, m_rect.size());
+ m_backing = GraphicsBitmap::create(*m_process, m_rect.size());
}
WSWindowManager::the().notify_rect_changed(*this, old_rect, rect);
}
@@ -124,11 +126,20 @@ void WSWindow::on_message(WSMessage& message)
return;
{
- LOCKER(m_process.gui_events_lock());
- m_process.gui_events().append(move(gui_event));
+ WSWindowLocker window_locker(*this);
+ if (!m_process)
+ return;
+ LOCKER(m_process->gui_events_lock());
+ m_process->gui_events().append(move(gui_event));
}
}
+void WSWindow::notify_process_died(Badge<Process>)
+{
+ WSWindowLocker locker(*this);
+ m_process = nullptr;
+}
+
void WSWindow::set_global_cursor_tracking_enabled(bool enabled)
{
dbgprintf("WSWindow{%p} global_cursor_tracking <- %u\n", enabled);