a BList member is allocated on stack now

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10878 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca
2005-01-19 16:46:36 +00:00
parent 4e51dee8d0
commit 4431e07a3a
2 changed files with 21 additions and 30 deletions
+20 -24
View File
@@ -40,8 +40,6 @@ CursorManager *cursormanager;
//! Initializes the CursorManager //! Initializes the CursorManager
CursorManager::CursorManager(void) CursorManager::CursorManager(void)
{ {
fCursorList=new BList(0);
// Error code for AddCursor // Error code for AddCursor
fTokenizer.ExcludeValue(B_ERROR); fTokenizer.ExcludeValue(B_ERROR);
@@ -88,14 +86,12 @@ CursorManager::CursorManager(void)
CursorManager::~CursorManager(void) CursorManager::~CursorManager(void)
{ {
ServerCursor *temp; ServerCursor *temp;
for(int32 i=0; i<fCursorList->CountItems();i++) for(int32 i=0; i<fCursorList.CountItems();i++)
{ {
temp=(ServerCursor*)fCursorList->ItemAt(i); temp=(ServerCursor*)fCursorList.ItemAt(i);
if(temp) if(temp)
delete temp; delete temp;
} }
fCursorList->MakeEmpty();
delete fCursorList;
// Note that it is not necessary to remove and delete the system // Note that it is not necessary to remove and delete the system
// cursors. These cursors are kept in the list with a NULL application // cursors. These cursors are kept in the list with a NULL application
@@ -115,7 +111,7 @@ int32 CursorManager::AddCursor(ServerCursor *sc)
return B_ERROR; return B_ERROR;
Lock(); Lock();
fCursorList->AddItem(sc); fCursorList.AddItem(sc);
int32 value=fTokenizer.GetToken(); int32 value=fTokenizer.GetToken();
sc->fToken=value; sc->fToken=value;
Unlock(); Unlock();
@@ -134,12 +130,12 @@ void CursorManager::DeleteCursor(int32 token)
Lock(); Lock();
ServerCursor *temp; ServerCursor *temp;
for(int32 i=0; i<fCursorList->CountItems();i++) for(int32 i=0; i<fCursorList.CountItems();i++)
{ {
temp=(ServerCursor*)fCursorList->ItemAt(i); temp=(ServerCursor*)fCursorList.ItemAt(i);
if(temp && temp->fToken==token) if(temp && temp->fToken==token)
{ {
fCursorList->RemoveItem(i); fCursorList.RemoveItem(i);
delete temp; delete temp;
break; break;
} }
@@ -156,19 +152,19 @@ void CursorManager::RemoveAppCursors(team_id team)
Lock(); Lock();
int32 i=0; int32 i=0;
ServerCursor *temp=(ServerCursor*)fCursorList->ItemAt(i); ServerCursor *temp=(ServerCursor*)fCursorList.ItemAt(i);
while(temp) while(temp)
{ {
if(temp && temp->OwningTeam()==team) if(temp && temp->OwningTeam()==team)
{ {
fCursorList->RemoveItem(i); fCursorList.RemoveItem(i);
delete temp; delete temp;
} }
else else
{ {
i++; i++;
} }
temp=(ServerCursor*)fCursorList->ItemAt(i); temp=(ServerCursor*)fCursorList.ItemAt(i);
} }
Unlock(); Unlock();
} }
@@ -373,7 +369,7 @@ void CursorManager::ChangeCursor(cursor_which which, int32 token)
if(cursor->GetAppSignature()) if(cursor->GetAppSignature())
cursor->SetAppSignature(""); cursor->SetAppSignature("");
fCursorList->RemoveItem(cursor); fCursorList.RemoveItem(cursor);
break; break;
} }
case B_CURSOR_TEXT: case B_CURSOR_TEXT:
@@ -385,7 +381,7 @@ void CursorManager::ChangeCursor(cursor_which which, int32 token)
if(cursor->GetAppSignature()) if(cursor->GetAppSignature())
cursor->SetAppSignature(""); cursor->SetAppSignature("");
fCursorList->RemoveItem(cursor); fCursorList.RemoveItem(cursor);
break; break;
} }
case B_CURSOR_MOVE: case B_CURSOR_MOVE:
@@ -397,7 +393,7 @@ void CursorManager::ChangeCursor(cursor_which which, int32 token)
if(cursor->GetAppSignature()) if(cursor->GetAppSignature())
cursor->SetAppSignature(""); cursor->SetAppSignature("");
fCursorList->RemoveItem(cursor); fCursorList.RemoveItem(cursor);
break; break;
} }
case B_CURSOR_DRAG: case B_CURSOR_DRAG:
@@ -409,7 +405,7 @@ void CursorManager::ChangeCursor(cursor_which which, int32 token)
if(cursor->GetAppSignature()) if(cursor->GetAppSignature())
cursor->SetAppSignature(""); cursor->SetAppSignature("");
fCursorList->RemoveItem(cursor); fCursorList.RemoveItem(cursor);
break; break;
} }
case B_CURSOR_RESIZE: case B_CURSOR_RESIZE:
@@ -421,7 +417,7 @@ void CursorManager::ChangeCursor(cursor_which which, int32 token)
if(cursor->GetAppSignature()) if(cursor->GetAppSignature())
cursor->SetAppSignature(""); cursor->SetAppSignature("");
fCursorList->RemoveItem(cursor); fCursorList.RemoveItem(cursor);
break; break;
} }
case B_CURSOR_RESIZE_NWSE: case B_CURSOR_RESIZE_NWSE:
@@ -433,7 +429,7 @@ void CursorManager::ChangeCursor(cursor_which which, int32 token)
if(cursor->GetAppSignature()) if(cursor->GetAppSignature())
cursor->SetAppSignature(""); cursor->SetAppSignature("");
fCursorList->RemoveItem(cursor); fCursorList.RemoveItem(cursor);
break; break;
} }
case B_CURSOR_RESIZE_NESW: case B_CURSOR_RESIZE_NESW:
@@ -445,7 +441,7 @@ void CursorManager::ChangeCursor(cursor_which which, int32 token)
if(cursor->GetAppSignature()) if(cursor->GetAppSignature())
cursor->SetAppSignature(""); cursor->SetAppSignature("");
fCursorList->RemoveItem(cursor); fCursorList.RemoveItem(cursor);
break; break;
} }
case B_CURSOR_RESIZE_NS: case B_CURSOR_RESIZE_NS:
@@ -457,7 +453,7 @@ void CursorManager::ChangeCursor(cursor_which which, int32 token)
if(cursor->GetAppSignature()) if(cursor->GetAppSignature())
cursor->SetAppSignature(""); cursor->SetAppSignature("");
fCursorList->RemoveItem(cursor); fCursorList.RemoveItem(cursor);
break; break;
} }
case B_CURSOR_RESIZE_EW: case B_CURSOR_RESIZE_EW:
@@ -469,7 +465,7 @@ void CursorManager::ChangeCursor(cursor_which which, int32 token)
if(cursor->GetAppSignature()) if(cursor->GetAppSignature())
cursor->SetAppSignature(""); cursor->SetAppSignature("");
fCursorList->RemoveItem(cursor); fCursorList.RemoveItem(cursor);
break; break;
} }
default: default:
@@ -487,9 +483,9 @@ void CursorManager::ChangeCursor(cursor_which which, int32 token)
ServerCursor *CursorManager::FindCursor(int32 token) ServerCursor *CursorManager::FindCursor(int32 token)
{ {
ServerCursor *temp; ServerCursor *temp;
for(int32 i=0; i<fCursorList->CountItems();i++) for(int32 i=0; i<fCursorList.CountItems();i++)
{ {
temp=(ServerCursor*)fCursorList->ItemAt(i); temp=(ServerCursor*)fCursorList.ItemAt(i);
if(temp && temp->fToken==token) if(temp && temp->fToken==token)
return temp; return temp;
} }
+1 -6
View File
@@ -51,11 +51,6 @@ public:
int32 AddCursor(ServerCursor *sc); int32 AddCursor(ServerCursor *sc);
void DeleteCursor(int32 token); void DeleteCursor(int32 token);
void RemoveAppCursors(team_id team); void RemoveAppCursors(team_id team);
void ShowCursor(void);
void HideCursor(void);
void ObscureCursor(void);
void SetCursor(int32 token);
void SetCursor(cursor_which which);
void SetCursorSet(const char *path); void SetCursorSet(const char *path);
ServerCursor *GetCursor(cursor_which which); ServerCursor *GetCursor(cursor_which which);
cursor_which GetCursorWhich(void); cursor_which GetCursorWhich(void);
@@ -64,7 +59,7 @@ public:
private: private:
ServerCursor *FindCursor(int32 token); ServerCursor *FindCursor(int32 token);
BList *fCursorList; BList fCursorList;
TokenHandler fTokenizer; TokenHandler fTokenizer;
// System cursor members // System cursor members