From ae507a54cd655a72ef1ab9bc78007e1c3d1abd5a Mon Sep 17 00:00:00 2001 From: Mathew Sutcliffe Date: Thu, 3 Apr 2014 17:09:02 +0100 Subject: [PATCH] refs #204 workaround an unexplained bug when casting QApplication by using inherits() and static_cast instead of qobject_cast --- src/blacksim/xplane/xbus/utils.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/blacksim/xplane/xbus/utils.h b/src/blacksim/xplane/xbus/utils.h index 488ca6c29..c9580ba12 100644 --- a/src/blacksim/xplane/xbus/utils.h +++ b/src/blacksim/xplane/xbus/utils.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -46,7 +47,11 @@ public: static char *argv[] = { "X-Plane" }; new QSharedApplication(ptr, argc, argv); } - return qobject_cast(instance())->m_weakptr; + if (! instance()->inherits("QSharedApplication")) + { + XPLMDebugString("Error: there is an unshared QApplication in another plugin\n"); + } + return static_cast(instance())->m_weakptr; } };