Merge lp:~gerboland/unity-mir/fix-shutdown-crash into lp:unity-mir

Proposed by Gerry Boland
Status: Merged
Approved by: Michał Sawicz
Approved revision: 149
Merged at revision: 149
Proposed branch: lp:~gerboland/unity-mir/fix-shutdown-crash
Merge into: lp:unity-mir
Diff against target: 36 lines (+7/-1)
2 files modified
src/modules/Unity/Application/inputarea.cpp (+6/-1)
src/modules/Unity/Application/inputarea.h (+1/-0)
To merge this branch: bzr merge lp:~gerboland/unity-mir/fix-shutdown-crash
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Michał Sawicz Approve
Review via email: mp+196677@code.launchpad.net

Commit message

InputArea: don't use lambda function as slot, can cause crash on shutdown

Using lambda function as slot can introduce crash as the slot's object deletion is not registered unlike with traditional signal/slot connections. As a result, on signal emission, the lambda can be called on a deleted object.

Description of the change

InputArea: don't use lambda function as slot, can cause crash on shutdown

Using lambda function as slot can introduce crash as the slot's object deletion is not registered unlike with traditional signal/slot connections. As a result, on signal emission, the lambda can be called on a deleted object.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

Fixes!

review: Approve
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Gerry, can you add that to you MP:
diff -u unity-mir-0.1+14.04.20131119/debian/changelog unity-mir-0.1+14.04.20131119/debian/changelog
--- unity-mir-0.1+14.04.20131119/debian/changelog
+++ unity-mir-0.1+14.04.20131119/debian/changelog
@@ -1,3 +1,10 @@
+unity-mir (0.1+14.04.20131119-0ubuntu2) trusty; urgency=low
+
+ * Cherry-pick upstream patch to avoid Unity8 crashing on stop
+ (LP: #1253685)
+
+ -- Didier Roche <email address hidden> Tue, 26 Nov 2013 10:47:29 +0100
+
 unity-mir (0.1+14.04.20131119-0ubuntu1) trusty; urgency=low

   [ Gerry Boland ]

Thanks! :)

Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/modules/Unity/Application/inputarea.cpp'
2--- src/modules/Unity/Application/inputarea.cpp 2013-10-31 12:35:59 +0000
3+++ src/modules/Unity/Application/inputarea.cpp 2013-11-26 09:22:16 +0000
4@@ -87,7 +87,7 @@
5 if (surface) {
6 // If surface is destroyed, make sure this InputArea doesn't point to it any more
7 // For now, the QML engine owns this object so the MirSurface cannot delete it
8- connect(surface, &MirSurface::destroyed, [this]() { doSetSurface(nullptr); });
9+ connect(surface, &MirSurface::destroyed, this, &InputArea::setNullSurface);
10 }
11
12 if (m_surface) {
13@@ -105,6 +105,11 @@
14 Q_EMIT surfaceChanged();
15 }
16
17+void InputArea::setNullSurface()
18+{
19+ doSetSurface(nullptr);
20+}
21+
22 void InputArea::geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry)
23 {
24 DLOG("InputArea::geometryChanged (this=%p)", this);
25
26=== modified file 'src/modules/Unity/Application/inputarea.h'
27--- src/modules/Unity/Application/inputarea.h 2013-08-29 14:46:43 +0000
28+++ src/modules/Unity/Application/inputarea.h 2013-11-26 09:22:16 +0000
29@@ -54,6 +54,7 @@
30 private Q_SLOTS:
31 void onAscendantChanged();
32 void onAscendantGeometryChanged();
33+ void setNullSurface();
34
35 private:
36 void listenToAscendantsChanges();

Subscribers

People subscribed via source and target branches