From c030c6fa68e6c6622abfbf769a5101c3b0ce0a31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 1 Jul 2005 10:13:50 +0000 Subject: [PATCH] As the comment says, deleting the cursor is not necessary. But since every single cursor is owned by a team - why the cursor manager? I must overlook something... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13385 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/CursorManager.cpp | 28 ++++++++++++---------------- src/servers/app/ServerApp.cpp | 4 ---- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/servers/app/CursorManager.cpp b/src/servers/app/CursorManager.cpp index 979f7b857f..6589dfbe71 100644 --- a/src/servers/app/CursorManager.cpp +++ b/src/servers/app/CursorManager.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, Haiku, Inc. +// Copyright (c) 2001-2005, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), @@ -147,25 +147,21 @@ void CursorManager::DeleteCursor(int32 token) \brief Removes and deletes all of an application's cursors \param signature Signature to which the cursors belong */ -void CursorManager::RemoveAppCursors(team_id team) +void +CursorManager::RemoveAppCursors(team_id team) { Lock(); - int32 i=0; - ServerCursor *temp=(ServerCursor*)fCursorList.ItemAt(i); - while(temp) - { - if(temp && temp->OwningTeam()==team) - { - fCursorList.RemoveItem(i); - delete temp; - } - else - { - i++; - } - temp=(ServerCursor*)fCursorList.ItemAt(i); + ServerCursor *cursor; + int32 index = 0; + while ((cursor = (ServerCursor*)fCursorList.ItemAt(index)) != NULL) { + if (cursor->OwningTeam() == team) { + fCursorList.RemoveItem(index); + delete cursor; + } else + index++; } + Unlock(); } diff --git a/src/servers/app/ServerApp.cpp b/src/servers/app/ServerApp.cpp index ab2bec9602..10161907bc 100644 --- a/src/servers/app/ServerApp.cpp +++ b/src/servers/app/ServerApp.cpp @@ -190,10 +190,6 @@ ServerApp::~ServerApp(void) delete static_cast(fPictureList.ItemAt(i)); } - // This shouldn't be necessary -- all cursors owned by the app - // should be cleaned up by RemoveAppCursors -// delete fAppCursor; - // although this isn't pretty, ATM we have only one RootLayer. // there should be a way that this ServerApp be attached to a particular // RootLayer to know which RootLayer's cursor to modify.