diff --git a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp index 5a82a3b2fa..50f72f92e0 100644 --- a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp @@ -282,6 +282,16 @@ TeamWindow::~TeamWindow() _SetActiveThread(NULL); delete fFilePanel; + + ThreadStackFrameSelectionEntry* entry + = fThreadSelectionInfoTable->Clear(true); + + while (entry != NULL) { + ThreadStackFrameSelectionEntry* next = entry->next; + delete entry; + entry = next; + } + delete fThreadSelectionInfoTable; if (fActiveSourceWorker > 0) diff --git a/src/kits/debugger/controllers/TeamDebugger.cpp b/src/kits/debugger/controllers/TeamDebugger.cpp index d5b3cda0d7..49f152e90c 100644 --- a/src/kits/debugger/controllers/TeamDebugger.cpp +++ b/src/kits/debugger/controllers/TeamDebugger.cpp @@ -366,7 +366,7 @@ TeamDebugger::Init(DebuggerInterface* interface, thread_id threadID, int argc, fFileManager); if (teamDebugInfo == NULL) return B_NO_MEMORY; - BReference teamDebugInfoReference(teamDebugInfo); + BReference teamDebugInfoReference(teamDebugInfo, true); error = teamDebugInfo->Init(); if (error != B_OK) diff --git a/src/kits/debugger/debug_info/FunctionInstance.cpp b/src/kits/debugger/debug_info/FunctionInstance.cpp index b7398f7887..1ecbd3af71 100644 --- a/src/kits/debugger/debug_info/FunctionInstance.cpp +++ b/src/kits/debugger/debug_info/FunctionInstance.cpp @@ -32,6 +32,7 @@ FunctionInstance::FunctionInstance(ImageDebugInfo* imageDebugInfo, FunctionInstance::~FunctionInstance() { SetFunction(NULL); + SetSourceCode(NULL, FUNCTION_SOURCE_NOT_LOADED); fFunctionDebugInfo->ReleaseReference(); } diff --git a/src/kits/debugger/debug_info/ImageDebugInfo.cpp b/src/kits/debugger/debug_info/ImageDebugInfo.cpp index 2c7c86c69e..88f6cde123 100644 --- a/src/kits/debugger/debug_info/ImageDebugInfo.cpp +++ b/src/kits/debugger/debug_info/ImageDebugInfo.cpp @@ -1,6 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2010-2013, Rene Gollent, rene@gollent.com. + * Copyright 2010-2017, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -27,12 +27,18 @@ ImageDebugInfo::~ImageDebugInfo() { for (int32 i = 0; FunctionInstance* function = fFunctions.ItemAt(i); i++) function->ReleaseReference(); + + for (int32 i = 0; SpecificImageDebugInfo* info = fSpecificInfos.ItemAt(i); + i++) { + info->ReleaseReference(); + } } bool ImageDebugInfo::AddSpecificInfo(SpecificImageDebugInfo* info) { + // NB: on success we take over the caller's reference to the info object return fSpecificInfos.AddItem(info); } diff --git a/src/kits/debugger/dwarf/DwarfManager.cpp b/src/kits/debugger/dwarf/DwarfManager.cpp index 9f36611e8c..9b5a07ebdc 100644 --- a/src/kits/debugger/dwarf/DwarfManager.cpp +++ b/src/kits/debugger/dwarf/DwarfManager.cpp @@ -1,6 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2014, Rene Gollent, rene@gollent.com. + * Copyright 2014-2017, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -25,6 +25,8 @@ DwarfManager::DwarfManager(uint8 addressSize) DwarfManager::~DwarfManager() { + while (DwarfFile* file = fFiles.RemoveHead()) + file->ReleaseReference(); } diff --git a/src/kits/debugger/files/FileManager.cpp b/src/kits/debugger/files/FileManager.cpp index bce3c02db0..fb614f1d97 100644 --- a/src/kits/debugger/files/FileManager.cpp +++ b/src/kits/debugger/files/FileManager.cpp @@ -1,6 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2011-2016, Rene Gollent, rene@gollent.com. + * Copyright 2011-2017, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -118,6 +118,12 @@ public: ~Domain() { + LocatableEntry* entry = fEntries.Clear(true); + while (entry != NULL) { + LocatableEntry* next = entry->fNext; + entry->ReleaseReference(); + entry = next; + } } status_t Init() @@ -555,6 +561,13 @@ FileManager::~FileManager() { delete fTargetDomain; delete fSourceDomain; + + SourceFileEntry* entry = fSourceFiles->Clear(); + while (entry != NULL) { + SourceFileEntry* next = entry->next; + delete entry; + next = entry; + } delete fSourceFiles; }