diff --git a/src/apps/debugger/model/Variable.cpp b/src/apps/debugger/model/Variable.cpp index 8e01442930..08653abcc6 100644 --- a/src/apps/debugger/model/Variable.cpp +++ b/src/apps/debugger/model/Variable.cpp @@ -6,22 +6,26 @@ #include "Variable.h" +#include "CpuState.h" #include "ObjectID.h" #include "Type.h" #include "ValueLocation.h" Variable::Variable(ObjectID* id, const BString& name, Type* type, - ValueLocation* location) + ValueLocation* location, CpuState* state) : fID(id), fName(name), fType(type), - fLocation(location) + fLocation(location), + fCpuState(state) { fID->AcquireReference(); fType->AcquireReference(); fLocation->AcquireReference(); + if (fCpuState != NULL) + fCpuState->AcquireReference(); } @@ -30,4 +34,6 @@ Variable::~Variable() fID->ReleaseReference(); fType->ReleaseReference(); fLocation->ReleaseReference(); + if (fCpuState != NULL) + fCpuState->ReleaseReference(); } diff --git a/src/apps/debugger/model/Variable.h b/src/apps/debugger/model/Variable.h index 9462c9a5d3..33fad51d78 100644 --- a/src/apps/debugger/model/Variable.h +++ b/src/apps/debugger/model/Variable.h @@ -11,6 +11,7 @@ #include +class CpuState; class ObjectID; class Type; class ValueLocation; @@ -19,19 +20,22 @@ class ValueLocation; class Variable : public BReferenceable { public: Variable(ObjectID* id, const BString& name, - Type* type, ValueLocation* location); + Type* type, ValueLocation* location, + CpuState* state = NULL); ~Variable(); ObjectID* ID() const { return fID; } const BString& Name() const { return fName; } Type* GetType() const { return fType; } ValueLocation* Location() const { return fLocation; } + CpuState* GetCpuState() const { return fCpuState; } private: ObjectID* fID; BString fName; Type* fType; ValueLocation* fLocation; + CpuState* fCpuState; };