[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [ring-kde/next] src: application: Delete the engine before the callmodel
From:       Emmanuel Lepage Vallee <null () kde ! org>
Date:       2017-07-31 20:22:26
Message-ID: E1dcHCs-0005G2-K0 () code ! kde ! org
[Download RAW message or body]

Git commit 84457ce31a5ca9bf1569e78752f233c384fea058 by Emmanuel Lepage Vallee.
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 = nullptr;
    }
 
    if (m_pTimeline) {
       m_pTimeline->setActive(false);
       delete m_pTimeline;
+      m_pTimeline = 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[]= "Ring";
 QQmlApplicationEngine* RingApplication::engine()
 {
    static QQmlApplicationEngine* e = nullptr;
+   static bool safetyCheck = false;
    if (!e) {
+      Q_ASSERT(safetyCheck == false);
+      safetyCheck = true;
       auto p1 = new RingQmlWidgets;
       p1->registerTypes("RingQmlWidgets");
 

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic