From kde-commits Mon Jul 31 20:22:26 2017 From: Emmanuel Lepage Vallee Date: Mon, 31 Jul 2017 20:22:26 +0000 To: kde-commits Subject: [ring-kde/next] src: application: Delete the engine before the callmodel Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=150153256019659 Git commit 84457ce31a5ca9bf1569e78752f233c384fea058 by Emmanuel Lepage Vall= ee. Committed on 31/07/2017 at 20:08. Pushed by lepagevalleeemmanuel into branch 'next'. application: Delete the engine before the callmodel Otherwise it might call deleted objects. M +8 -1 src/ringapplication.cpp https://commits.kde.org/ring-kde/84457ce31a5ca9bf1569e78752f233c384fea058 diff --git a/src/ringapplication.cpp b/src/ringapplication.cpp index 32a6c743..8b51b99d 100644 --- a/src/ringapplication.cpp +++ b/src/ringapplication.cpp @@ -148,15 +148,19 @@ RingApplication::~RingApplication() if (m_pPhone) { m_pPhone->setActive(false); delete m_pPhone; + m_pTimeline =3D nullptr; } = if (m_pTimeline) { m_pTimeline->setActive(false); delete m_pTimeline; + m_pTimeline =3D nullptr; } = - delete &CallModel::instance(); + delete engine(); + delete &PersonModel::instance(); + delete &CallModel::instance(); } = RingApplication* RingApplication::instance(int& argc, char** argv) @@ -338,7 +342,10 @@ constexpr static const char AppName[]=3D "Ring"; QQmlApplicationEngine* RingApplication::engine() { static QQmlApplicationEngine* e =3D nullptr; + static bool safetyCheck =3D false; if (!e) { + Q_ASSERT(safetyCheck =3D=3D false); + safetyCheck =3D true; auto p1 =3D new RingQmlWidgets; p1->registerTypes("RingQmlWidgets"); =