summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@digia.com>2012-02-13 13:45:11 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-09-12 11:40:18 (GMT)
commit5032ca8cde5ed6fa39acfde650d373fcb4ea7807 (patch)
tree9ae01976a24a8f5ed03fe072f06773affd0fcb12
parent111889ea5a1b40e3dc54380298096a978e9a5684 (diff)
downloadQt-5032ca8cde5ed6fa39acfde650d373fcb4ea7807.zip
Qt-5032ca8cde5ed6fa39acfde650d373fcb4ea7807.tar.gz
Qt-5032ca8cde5ed6fa39acfde650d373fcb4ea7807.tar.bz2
Ensure that QApplication is cleaned up after itself on Mac
If the sendEvent function is replaced on the NSApplication, then QApplication should ensure that it undoes that if it is destroyed while the NSApplication is still running. Task-number: QTBUG-24248 Change-Id: I087ae575b7d670fa8dacfb80636d813c7bceb41d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@nokia.com>
-rw-r--r--src/gui/kernel/qapplication_mac.mm5
-rw-r--r--src/gui/kernel/qcocoaapplication_mac.mm7
-rw-r--r--src/gui/kernel/qcocoaapplication_mac_p.h1
3 files changed, 13 insertions, 0 deletions
diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm
index d01f296..141f390 100644
--- a/src/gui/kernel/qapplication_mac.mm
+++ b/src/gui/kernel/qapplication_mac.mm
@@ -1311,6 +1311,11 @@ void qt_cleanup()
}
#endif
qt_release_apple_event_handler();
+
+#ifdef QT_MAC_USE_COCOA
+ qt_resetNSApplicationSendEvent();
+#endif
+
qt_release_tablet_proximity_handler();
if (tablet_proximity_UPP)
DisposeEventHandlerUPP(tablet_proximity_UPP);
diff --git a/src/gui/kernel/qcocoaapplication_mac.mm b/src/gui/kernel/qcocoaapplication_mac.mm
index 5168ae5..f595d78 100644
--- a/src/gui/kernel/qcocoaapplication_mac.mm
+++ b/src/gui/kernel/qcocoaapplication_mac.mm
@@ -218,5 +218,12 @@ void qt_redirectNSApplicationSendEvent()
@selector(qt_sendEvent_original:));
}
+void qt_resetNSApplicationSendEvent()
+{
+ qt_cocoa_change_back_implementation([NSApplication class],
+ @selector(sendEvent:),
+ @selector(qt_sendEvent_original:));
+}
+
QT_END_NAMESPACE
#endif
diff --git a/src/gui/kernel/qcocoaapplication_mac_p.h b/src/gui/kernel/qcocoaapplication_mac_p.h
index 60e3062..12ea783 100644
--- a/src/gui/kernel/qcocoaapplication_mac_p.h
+++ b/src/gui/kernel/qcocoaapplication_mac_p.h
@@ -111,6 +111,7 @@ QT_FORWARD_DECLARE_CLASS(QApplicationPrivate)
QT_BEGIN_NAMESPACE
void qt_redirectNSApplicationSendEvent();
+void qt_resetNSApplicationSendEvent();
QT_END_NAMESPACE