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
This commit is contained in:
Stephan Aßmus
2010-08-31 11:45:53 +00:00
parent 45db9a2073
commit 5911196b9c
+12 -7
View File
@@ -2963,16 +2963,21 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
BRect bounds; BRect bounds;
link.Read<BRect>(&bounds); link.Read<BRect>(&bounds);
bool success = false;
ServerBitmap* bitmap = GetBitmap(token); ServerBitmap* bitmap = GetBitmap(token);
if (bitmap != NULL) { if (bitmap != NULL) {
if (fDesktop->GetDrawingEngine()->ReadBitmap(bitmap, if (fDesktop->GetDrawingEngine()->LockExclusiveAccess()) {
drawCursor, bounds) == B_OK) { success = fDesktop->GetDrawingEngine()->ReadBitmap(bitmap,
fLink.StartMessage(B_OK); drawCursor, bounds) == B_OK;
} else fDesktop->GetDrawingEngine()->UnlockExclusiveAccess();
fLink.StartMessage(B_BAD_VALUE); }
bitmap->ReleaseReference(); bitmap->ReleaseReference();
} else }
if (success)
fLink.StartMessage(B_OK);
else
fLink.StartMessage(B_BAD_VALUE); fLink.StartMessage(B_BAD_VALUE);
fLink.Flush(); fLink.Flush();