GUIInvoke takes a QObject* to avoid callbacks after object lifetime

* The GUIInvoke object takes a QObject, and uses QPointer to check that
  it hasn't been deleted when the callback fires. This prevents delayed
  callbacks from executing after the object has been deleted and
  crashing.
* In most cases the pointer is just 'this'.
This commit is contained in:
baldurk
2018-05-08 11:54:34 +01:00
parent c880def5ef
commit 082ab4d75d
25 changed files with 113 additions and 108 deletions
@@ -805,7 +805,7 @@ void PythonContext::outstream_del(PyObject *self)
PythonContext *context = redirector->context;
// delete the context on the UI thread.
GUIInvoke::call([context]() { delete context; });
GUIInvoke::call(context, [context]() { delete context; });
}
}