@@ -33,6 +33,9 @@
3333
3434ShellApplication::ShellApplication(int & argc, char ** argv, bool isMirServer)
3535 : QGuiApplication(argc, argv)
36+ , m_shellView(nullptr)
37+ , m_secondaryWindow(nullptr)
38+ , m_mouseTouchAdaptor(nullptr)
3639{
3740
3841 setApplicationName(QStringLiteral("unity8"));
@@ -116,12 +119,22 @@ ShellApplication::ShellApplication(int & argc, char ** argv, bool isMirServer)
116119}
117120
118121ShellApplication::~ShellApplication()
122+{
123+ destroyResources();
124+}
125+
126+void ShellApplication::destroyResources()
119127{
120128 // Deletion order is important. Don't use QScopedPointers and the like
121129 // Otherwise the process will hang on shutdown (bug somewhere I guess).
122130 delete m_shellView;
131+ m_shellView = nullptr;
132+
123133 delete m_secondaryWindow;
134+ m_secondaryWindow = nullptr;
135+
124136 delete m_mouseTouchAdaptor;
137+ m_mouseTouchAdaptor = nullptr;
125138}
126139
127140void ShellApplication::setupQmlEngine(bool isMirServer)