From 5911196b9cd5ce86a9fea422a277da7628e0fb4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Tue, 31 Aug 2010 11:45:53 +0000 Subject: [PATCH] Reading the contents of the screen requires the exclusive lock to avoid someone drawing into it at the same time. In a debug build, this avoids hitting an ASSERT. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38478 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/ServerApp.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/servers/app/ServerApp.cpp b/src/servers/app/ServerApp.cpp index 031cbccc71..96b21d5211 100644 --- a/src/servers/app/ServerApp.cpp +++ b/src/servers/app/ServerApp.cpp @@ -2963,16 +2963,21 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link) BRect bounds; link.Read(&bounds); + bool success = false; + ServerBitmap* bitmap = GetBitmap(token); if (bitmap != NULL) { - if (fDesktop->GetDrawingEngine()->ReadBitmap(bitmap, - drawCursor, bounds) == B_OK) { - fLink.StartMessage(B_OK); - } else - fLink.StartMessage(B_BAD_VALUE); - + if (fDesktop->GetDrawingEngine()->LockExclusiveAccess()) { + success = fDesktop->GetDrawingEngine()->ReadBitmap(bitmap, + drawCursor, bounds) == B_OK; + fDesktop->GetDrawingEngine()->UnlockExclusiveAccess(); + } bitmap->ReleaseReference(); - } else + } + + if (success) + fLink.StartMessage(B_OK); + else fLink.StartMessage(B_BAD_VALUE); fLink.Flush();