Fix memory leak + style cleanup. Thanks Axel!

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38787 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Philippe Houdoin
2010-09-22 11:23:14 +00:00
parent c1e73fbf52
commit 30c47afa79
3 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -247,7 +247,7 @@ Debugger::MessageReceived(BMessage* message)
fTeamsWindow = TeamsWindow::Create(&fSettingsManager); fTeamsWindow = TeamsWindow::Create(&fSettingsManager);
if (fTeamsWindow != NULL) if (fTeamsWindow != NULL)
fTeamsWindow->Show(); fTeamsWindow->Show();
} catch(...) { } catch (...) {
// TODO: Notify the user! // TODO: Notify the user!
fprintf(stderr, "Error: Failed to create Teams window\n"); fprintf(stderr, "Error: Failed to create Teams window\n");
} }
@@ -3,6 +3,7 @@
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#include <new> #include <new>
#include <stdio.h> #include <stdio.h>
@@ -245,7 +246,7 @@ TeamsListView::MessageReceived(BMessage* message)
TeamListItem* item = new(std::nothrow) TeamListItem(team); TeamListItem* item = new(std::nothrow) TeamListItem(team);
if (item != NULL) { if (item != NULL) {
AddItem(new TeamListItem(team)); AddItem(item);
SortItems(&TeamListItem::Compare); SortItems(&TeamListItem::Compare);
} }
break; break;
@@ -3,6 +3,7 @@
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#include <new> #include <new>
#include <stdio.h> #include <stdio.h>
@@ -44,7 +45,7 @@ TeamsWindow::Create(SettingsManager* settingsManager)
try { try {
self->_Init(); self->_Init();
} catch(...) { } catch (...) {
delete self; delete self;
throw; throw;
} }