summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/EventWindowController.cpp5
-rw-r--r--Swift/Controllers/MainController.cpp2
-rw-r--r--Swift/Controllers/RosterController.cpp4
-rw-r--r--Swift/Controllers/UIInterfaces/EventWindow.h9
-rw-r--r--Swift/Controllers/UIInterfaces/MainWindow.h14
5 files changed, 25 insertions, 9 deletions
diff --git a/Swift/Controllers/EventWindowController.cpp b/Swift/Controllers/EventWindowController.cpp
index a8c8f11..18c37f4 100644
--- a/Swift/Controllers/EventWindowController.cpp
+++ b/Swift/Controllers/EventWindowController.cpp
@@ -18,8 +18,9 @@ EventWindowController::EventWindowController(EventController* eventController, E
}
EventWindowController::~EventWindowController() {
- // Don't delete this, since Qt owns it
- //delete window_;
+ if (window_->canDelete()) {
+ delete window_;
+ }
}
void EventWindowController::handleEventQueueEventAdded(boost::shared_ptr<StanzaEvent> event) {
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index 837e576..7cf68a1 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -494,8 +494,6 @@ void MainController::handleCancelLoginRequest() {
void MainController::signOut() {
logout();
loginWindow_->loggedOut();
- delete rosterController_;
- rosterController_ = NULL;
resetClient();
}
diff --git a/Swift/Controllers/RosterController.cpp b/Swift/Controllers/RosterController.cpp
index defd1c6..580e12b 100644
--- a/Swift/Controllers/RosterController.cpp
+++ b/Swift/Controllers/RosterController.cpp
@@ -67,7 +67,9 @@ RosterController::RosterController(const JID& jid, XMPPRoster* xmppRoster, Avata
RosterController::~RosterController() {
delete offlineFilter_;
delete expandiness_;
- delete mainWindow_;
+ if (mainWindow_->canDelete()) {
+ delete mainWindow_;
+ }
delete roster_;
}
diff --git a/Swift/Controllers/UIInterfaces/EventWindow.h b/Swift/Controllers/UIInterfaces/EventWindow.h
index 0999e0e..e756655 100644
--- a/Swift/Controllers/UIInterfaces/EventWindow.h
+++ b/Swift/Controllers/UIInterfaces/EventWindow.h
@@ -12,8 +12,17 @@
namespace Swift {
class EventWindow {
public:
+ EventWindow(bool candelete = true) : canDelete_(candelete) {}
+
+ bool canDelete() const {
+ return canDelete_;
+ }
+
virtual ~EventWindow() {};
virtual void addEvent(boost::shared_ptr<StanzaEvent> event, bool active) = 0;
virtual void removeEvent(boost::shared_ptr<StanzaEvent> event) = 0;
+
+ private:
+ bool canDelete_;
};
}
diff --git a/Swift/Controllers/UIInterfaces/MainWindow.h b/Swift/Controllers/UIInterfaces/MainWindow.h
index 5d0c14e..570c919 100644
--- a/Swift/Controllers/UIInterfaces/MainWindow.h
+++ b/Swift/Controllers/UIInterfaces/MainWindow.h
@@ -4,8 +4,7 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_MainWindow_H
-#define SWIFTEN_MainWindow_H
+#pragma once
#include "Swiften/Base/String.h"
#include "Swiften/JID/JID.h"
@@ -19,7 +18,13 @@ namespace Swift {
class MainWindow {
public:
+ MainWindow(bool candelete = true) : canDelete_(candelete) {}
virtual ~MainWindow() {};
+
+ bool canDelete() const {
+ return canDelete_;
+ }
+
virtual void setMyName(const String& name) = 0;
virtual void setMyAvatarPath(const String& path) = 0;
virtual void setMyStatusText(const String& status) = 0;
@@ -29,7 +34,8 @@ namespace Swift {
boost::signal<void (StatusShow::Type, const String&)> onChangeStatusRequest;
boost::signal<void (bool)> onShowOfflineToggled;
boost::signal<void ()> onSignOutRequest;
+
+ private:
+ bool canDelete_;
};
}
-#endif
-