From 52b3e056cd6ff7f2bb7d68dec346f8a7ad8d3548 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 9 Mar 2006 15:51:52 +0000 Subject: [PATCH] AS_SET_CURSOR now grabs a reference to the current app cursor, so that it won't be deleted when the local BCursor object is gone. This should fix bug #275 (ScummVM should no longer have two cursors), not tested yet, though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16676 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/ServerApp.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/servers/app/ServerApp.cpp b/src/servers/app/ServerApp.cpp index 469f5dd26e..bcca14e84b 100644 --- a/src/servers/app/ServerApp.cpp +++ b/src/servers/app/ServerApp.cpp @@ -938,14 +938,22 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link) link.Read(&sync); link.Read(&token); + ServerCursor* oldCursor = fAppCursor; fAppCursor = fDesktop->GetCursorManager().FindCursor(token); - if (fAppCursor != NULL) + if (fAppCursor != NULL) { + fAppCursor->Acquire(); + // TODO: This is wrong: We need to take view cursors into account here! fDesktop->HWInterface()->SetCursor(fAppCursor); - else { - // if there is no new cursor, we just set the default cursor - fDesktop->HWInterface()->SetCursor(fDesktop->GetCursorManager().GetCursor(B_CURSOR_DEFAULT)); + } else { + // if the new cursor doesn't exist, we just set the default cursor + // TODO: This is wrong: We need to take view cursors into account here! + fDesktop->HWInterface()->SetCursor( + fDesktop->GetCursorManager().GetCursor(B_CURSOR_DEFAULT)); } + if (oldCursor != NULL) + oldCursor->Release(); + if (sync) { // The application is expecting a reply fLink.StartMessage(B_OK);