Made Team BReferenceable. Since teams are usually destroyed before their main
thread, we were accessing already destroyed Team objects. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35591 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include <debug_support.h>
|
#include <debug_support.h>
|
||||||
#include <ObjectList.h>
|
#include <ObjectList.h>
|
||||||
|
#include <Referenceable.h>
|
||||||
#include <util/DoublyLinkedList.h>
|
#include <util/DoublyLinkedList.h>
|
||||||
|
|
||||||
#include "Thread.h"
|
#include "Thread.h"
|
||||||
@@ -19,7 +20,7 @@ class SharedImage;
|
|||||||
struct system_profiler_team_added;
|
struct system_profiler_team_added;
|
||||||
|
|
||||||
|
|
||||||
class Team {
|
class Team : public BReferenceable {
|
||||||
public:
|
public:
|
||||||
Team();
|
Team();
|
||||||
~Team();
|
~Team();
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ Thread::Thread(thread_id threadID, const char* name, Team* team)
|
|||||||
fProfileResult(NULL),
|
fProfileResult(NULL),
|
||||||
fLazyImages(true)
|
fLazyImages(true)
|
||||||
{
|
{
|
||||||
|
fTeam->AcquireReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -66,6 +67,8 @@ Thread::~Thread()
|
|||||||
delete image;
|
delete image;
|
||||||
while (ThreadImage* image = fOldImages.RemoveHead())
|
while (ThreadImage* image = fOldImages.RemoveHead())
|
||||||
delete image;
|
delete image;
|
||||||
|
|
||||||
|
fTeam->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ class ThreadManager : private ProfiledEntity {
|
|||||||
public:
|
public:
|
||||||
ThreadManager(port_id debuggerPort)
|
ThreadManager(port_id debuggerPort)
|
||||||
:
|
:
|
||||||
fTeams(20, true),
|
fTeams(20),
|
||||||
fThreads(20, true),
|
fThreads(20, true),
|
||||||
fKernelTeam(NULL),
|
fKernelTeam(NULL),
|
||||||
fDebuggerPort(debuggerPort),
|
fDebuggerPort(debuggerPort),
|
||||||
@@ -117,6 +117,9 @@ public:
|
|||||||
|
|
||||||
if (fSummaryProfileResult != NULL)
|
if (fSummaryProfileResult != NULL)
|
||||||
fSummaryProfileResult->ReleaseReference();
|
fSummaryProfileResult->ReleaseReference();
|
||||||
|
|
||||||
|
for (int32 i = 0; Team* team = fTeams.ItemAt(i); i++)
|
||||||
|
team->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t Init()
|
status_t Init()
|
||||||
@@ -193,7 +196,8 @@ public:
|
|||||||
if (Team* team = FindTeam(teamID)) {
|
if (Team* team = FindTeam(teamID)) {
|
||||||
if (team == fKernelTeam)
|
if (team == fKernelTeam)
|
||||||
fKernelTeam = NULL;
|
fKernelTeam = NULL;
|
||||||
fTeams.RemoveItem(team, true);
|
fTeams.RemoveItem(team);
|
||||||
|
team->ReleaseReference();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,7 +312,7 @@ private:
|
|||||||
? _InitUndebuggedTeam(team, addedInfo)
|
? _InitUndebuggedTeam(team, addedInfo)
|
||||||
: _InitDebuggedTeam(team, teamID);
|
: _InitDebuggedTeam(team, teamID);
|
||||||
if (error != B_OK) {
|
if (error != B_OK) {
|
||||||
delete team;
|
team->ReleaseReference();
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user