summaryrefslogtreecommitdiffstats
path: root/src/input
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2015-08-04 10:16:28 +0100
committerSean Harmer <sean.harmer@kdab.com>2015-08-05 10:07:18 +0000
commite293f0f5a1d4a69294c9ff603264ed5c65f87d8c (patch)
treee356091972c873d0ae5f1405ea4d7a5b6b699a8d /src/input
parent3811b0bd8fded65478439bec9dea7a3b6cd26a59 (diff)
Fix crash when shutting down due to cloning a deleted object
Change-Id: If5d6b12553aff5164e3edf351abb956f612b6fcf Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/input')
-rw-r--r--src/input/qmouseinput.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/input/qmouseinput.cpp b/src/input/qmouseinput.cpp
index 49c8654a1..03ccf5413 100644
--- a/src/input/qmouseinput.cpp
+++ b/src/input/qmouseinput.cpp
@@ -129,7 +129,12 @@ void QMouseInput::copy(const QNode *ref)
Q_D(QMouseInput);
const QMouseInput *refInput = static_cast<const QMouseInput *>(ref);
d->m_containsMouse = refInput->containsMouse();
- if (refInput)
+
+ // TODO: We may want to store the controller id and only send a clone when we are the parent
+ // of the controller.
+ // Perhaps it's time to investigate sending a "kernel" or "seed" over to the backend rather
+ // than a complete clone.
+ if (refInput && refInput->controller()->parent() == ref)
d->m_controller = static_cast<QMouseController *>(QNode::clone(refInput->controller()));
}