summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2013-01-17 16:11:43 (GMT)
committerSwift Review <review@swift.im>2013-01-27 22:11:12 (GMT)
commit28c99a37d09a68ef993330b9ece2732ec03eba8f (patch)
treefa21b0d626055842ffcaee5d8fa5a1f7552cf38c /Swift/Controllers
parent17aaca4d226e48396437c512b6ea1873fc75b56c (diff)
downloadswift-28c99a37d09a68ef993330b9ece2732ec03eba8f.zip
swift-28c99a37d09a68ef993330b9ece2732ec03eba8f.tar.bz2
Fixing VCard related crash caused by wrong deletion of profile window.
Change-Id: Ifab6b304f0e25ab323b4a354f4682291e6aa1078 License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/ProfileController.cpp7
-rw-r--r--Swift/Controllers/ProfileController.h1
-rw-r--r--Swift/Controllers/ShowProfileController.cpp8
-rw-r--r--Swift/Controllers/ShowProfileController.h2
-rw-r--r--Swift/Controllers/UIInterfaces/ProfileWindow.h2
5 files changed, 12 insertions, 8 deletions
diff --git a/Swift/Controllers/ProfileController.cpp b/Swift/Controllers/ProfileController.cpp
index e641988..241cc2e 100644
--- a/Swift/Controllers/ProfileController.cpp
+++ b/Swift/Controllers/ProfileController.cpp
@@ -25,7 +25,7 @@ ProfileController::~ProfileController() {
if (profileWindow) {
vcardManager->onOwnVCardChanged.disconnect(boost::bind(&ProfileController::handleOwnVCardChanged, this, _1));
profileWindow->onVCardChangeRequest.disconnect(boost::bind(&ProfileController::handleVCardChangeRequest, this, _1));
- delete profileWindow;
+ profileWindow->onWindowAboutToBeClosed.disconnect(boost::bind(&ProfileController::handleProfileWindowAboutToBeClosed, this, _1));
}
uiEventStream->onUIEvent.disconnect(boost::bind(&ProfileController::handleUIEvent, this, _1));
}
@@ -39,6 +39,7 @@ void ProfileController::handleUIEvent(UIEvent::ref event) {
profileWindow = profileWindowFactory->createProfileWindow();
profileWindow->setEditable(true);
profileWindow->onVCardChangeRequest.connect(boost::bind(&ProfileController::handleVCardChangeRequest, this, _1));
+ profileWindow->onWindowAboutToBeClosed.connect(boost::bind(&ProfileController::handleProfileWindowAboutToBeClosed, this, _1));
vcardManager->onOwnVCardChanged.connect(boost::bind(&ProfileController::handleOwnVCardChanged, this, _1));
}
gettingVCard = true;
@@ -76,6 +77,10 @@ void ProfileController::handleOwnVCardChanged(VCard::ref vcard) {
}
}
+void ProfileController::handleProfileWindowAboutToBeClosed(const JID&) {
+ profileWindow = NULL;
+}
+
void ProfileController::setAvailable(bool b) {
available = b;
if (!available) {
diff --git a/Swift/Controllers/ProfileController.h b/Swift/Controllers/ProfileController.h
index c1afcf9..538df36 100644
--- a/Swift/Controllers/ProfileController.h
+++ b/Swift/Controllers/ProfileController.h
@@ -29,6 +29,7 @@ namespace Swift {
void handleVCardChangeRequest(VCard::ref vcard);
void handleSetVCardResponse(ErrorPayload::ref);
void handleOwnVCardChanged(VCard::ref vcard);
+ void handleProfileWindowAboutToBeClosed(const JID&);
void updateDialogStatus();
private:
diff --git a/Swift/Controllers/ShowProfileController.cpp b/Swift/Controllers/ShowProfileController.cpp
index ee0854b..15b7b26 100644
--- a/Swift/Controllers/ShowProfileController.cpp
+++ b/Swift/Controllers/ShowProfileController.cpp
@@ -25,7 +25,7 @@ ShowProfileController::ShowProfileController(VCardManager* vcardManager, Profile
ShowProfileController::~ShowProfileController() {
typedef std::pair<JID, ProfileWindow*> JIDProfileWindowPair;
foreach(const JIDProfileWindowPair& jidWndPair, openedProfileWindows) {
- jidWndPair.second->onWindowClosed.disconnect(boost::bind(&ShowProfileController::handleProfileWindowClosed, this, _1));
+ jidWndPair.second->onWindowAboutToBeClosed.disconnect(boost::bind(&ShowProfileController::handleProfileWindowAboutToBeClosed, this, _1));
delete jidWndPair.second;
}
@@ -42,7 +42,7 @@ void ShowProfileController::handleUIEvent(UIEvent::ref event) {
if (openedProfileWindows.find(showProfileEvent->getJID()) == openedProfileWindows.end()) {
ProfileWindow* newProfileWindow = profileWindowFactory->createProfileWindow();
newProfileWindow->setJID(showProfileEvent->getJID());
- newProfileWindow->onWindowClosed.connect(boost::bind(&ShowProfileController::handleProfileWindowClosed, this, _1));
+ newProfileWindow->onWindowAboutToBeClosed.connect(boost::bind(&ShowProfileController::handleProfileWindowAboutToBeClosed, this, _1));
openedProfileWindows[showProfileEvent->getJID()] = newProfileWindow;
VCard::ref vcard = vcardManager->getVCardAndRequestWhenNeeded(showProfileEvent->getJID());
if (vcard) {
@@ -67,10 +67,8 @@ void ShowProfileController::handleVCardChanged(const JID& jid, VCard::ref vcard)
profileWindow->show();
}
-void ShowProfileController::handleProfileWindowClosed(const JID& profileJid) {
- ProfileWindow* profileWindow = openedProfileWindows[profileJid];
+void ShowProfileController::handleProfileWindowAboutToBeClosed(const JID& profileJid) {
openedProfileWindows.erase(profileJid);
- delete profileWindow;
}
}
diff --git a/Swift/Controllers/ShowProfileController.h b/Swift/Controllers/ShowProfileController.h
index 5646f5e..27a0cf4 100644
--- a/Swift/Controllers/ShowProfileController.h
+++ b/Swift/Controllers/ShowProfileController.h
@@ -25,7 +25,7 @@ namespace Swift {
private:
void handleUIEvent(UIEvent::ref event);
void handleVCardChanged(const JID&, VCard::ref);
- void handleProfileWindowClosed(const JID& profileJid);
+ void handleProfileWindowAboutToBeClosed(const JID& profileJid);
private:
VCardManager* vcardManager;
diff --git a/Swift/Controllers/UIInterfaces/ProfileWindow.h b/Swift/Controllers/UIInterfaces/ProfileWindow.h
index 0ce2ccf..5c158e1 100644
--- a/Swift/Controllers/UIInterfaces/ProfileWindow.h
+++ b/Swift/Controllers/UIInterfaces/ProfileWindow.h
@@ -30,6 +30,6 @@ namespace Swift {
virtual void hide() = 0;
boost::signal<void (VCard::ref)> onVCardChangeRequest;
- boost::signal<void (const JID&)> onWindowClosed;
+ boost::signal<void (const JID&)> onWindowAboutToBeClosed;
};
}