diff --git a/src/mainapplication.cpp b/src/mainapplication.cpp
index 7a7aebe69d17503a46a4ce0f4bf5d38df6917938..4abceb694d5b1b8251007436ce05b09db82bd0ef 100644
--- a/src/mainapplication.cpp
+++ b/src/mainapplication.cpp
@@ -161,11 +161,20 @@ MainApplication::MainApplication(int& argc, char** argv)
     , engine_(new QQmlApplicationEngine())
     , connectivityMonitor_(new ConnectivityMonitor(this))
     , settingsManager_(new AppSettingsManager(this))
-    , systemTray_(new SystemTray(settingsManager_, this))
+    , systemTray_(new SystemTray(settingsManager_.get(), this))
 {
     QObject::connect(this, &QApplication::aboutToQuit, [this] { cleanup(); });
 }
 
+MainApplication::~MainApplication()
+{
+    engine_.reset();
+    systemTray_.reset();
+    settingsManager_.reset();
+    lrcInstance_.reset();
+    connectivityMonitor_.reset();
+}
+
 bool
 MainApplication::init()
 {
@@ -194,7 +203,7 @@ MainApplication::init()
     gnutls_global_init();
 #endif
 
-    initLrc(results[opts::UPDATEURL].toString(), connectivityMonitor_);
+    initLrc(results[opts::UPDATEURL].toString(), connectivityMonitor_.get());
 
 #ifdef Q_OS_UNIX
     GlobalInstances::setDBusErrorHandler(std::make_unique<Interfaces::DBusErrorHandler>());
@@ -223,7 +232,7 @@ MainApplication::init()
     }
 #endif
 
-    connect(connectivityMonitor_, &ConnectivityMonitor::connectivityChanged, [this] {
+    connect(connectivityMonitor_.get(), &ConnectivityMonitor::connectivityChanged, [this] {
         lrcInstance_->connectivityChanged();
     });
 
@@ -414,14 +423,16 @@ void
 MainApplication::initQmlLayer()
 {
     // setup the adapters (their lifetimes are that of MainApplication)
-    auto callAdapter = new CallAdapter(systemTray_, lrcInstance_.data(), this);
-    auto messagesAdapter = new MessagesAdapter(settingsManager_, lrcInstance_.data(), this);
-    auto conversationsAdapter = new ConversationsAdapter(systemTray_, lrcInstance_.data(), this);
+    auto callAdapter = new CallAdapter(systemTray_.get(), lrcInstance_.data(), this);
+    auto messagesAdapter = new MessagesAdapter(settingsManager_.get(), lrcInstance_.data(), this);
+    auto conversationsAdapter = new ConversationsAdapter(systemTray_.get(),
+                                                         lrcInstance_.data(),
+                                                         this);
     auto avAdapter = new AvAdapter(lrcInstance_.data(), this);
     auto contactAdapter = new ContactAdapter(lrcInstance_.data(), this);
-    auto accountAdapter = new AccountAdapter(settingsManager_, lrcInstance_.data(), this);
-    auto utilsAdapter = new UtilsAdapter(systemTray_, lrcInstance_.data(), this);
-    auto settingsAdapter = new SettingsAdapter(settingsManager_, lrcInstance_.data(), this);
+    auto accountAdapter = new AccountAdapter(settingsManager_.get(), lrcInstance_.data(), this);
+    auto utilsAdapter = new UtilsAdapter(systemTray_.get(), lrcInstance_.data(), this);
+    auto settingsAdapter = new SettingsAdapter(settingsManager_.get(), lrcInstance_.data(), this);
     auto pluginAdapter = new PluginAdapter(lrcInstance_.data(), this);
 
     // qml adapter registration
@@ -473,7 +484,7 @@ MainApplication::initSystray()
         engine_->quit();
         cleanup();
     });
-    connect(systemTray_,
+    connect(systemTray_.get(),
             &QSystemTrayIcon::activated,
             [this](QSystemTrayIcon::ActivationReason reason) {
                 if (reason != QSystemTrayIcon::ActivationReason::Context)
diff --git a/src/mainapplication.h b/src/mainapplication.h
index 58c8a67f61a0f205eaf4213c2d7e5dc0fe939587..f7b17832a5baa9d220350cf6d364a116dc72092c 100644
--- a/src/mainapplication.h
+++ b/src/mainapplication.h
@@ -71,7 +71,7 @@ class MainApplication : public QApplication
 
 public:
     explicit MainApplication(int& argc, char** argv);
-    ~MainApplication() = default;
+    ~MainApplication();
 
     bool init();
     void restoreApp();
@@ -94,9 +94,9 @@ private:
 
     QScopedPointer<LRCInstance> lrcInstance_;
 
-    ConnectivityMonitor* connectivityMonitor_;
-    AppSettingsManager* settingsManager_;
-    SystemTray* systemTray_;
+    QScopedPointer<ConnectivityMonitor> connectivityMonitor_;
+    QScopedPointer<AppSettingsManager> settingsManager_;
+    QScopedPointer<SystemTray> systemTray_;
 
     ScreenInfo screenInfo_;