on xenial help sign in
Another round of changes for fixing the hang on shutdown
400eb69Daniel d'Andrada
src/ShellApplication.cpp+13
@@ -33,6 +33,9 @@
33
33
34ShellApplication::ShellApplication(int & argc, char ** argv, bool isMirServer)
34ShellApplication::ShellApplication(int & argc, char ** argv, bool isMirServer)
35 : QGuiApplication(argc, argv)
35 : QGuiApplication(argc, argv)
36+ , m_shellView(nullptr)
37+ , m_secondaryWindow(nullptr)
38+ , m_mouseTouchAdaptor(nullptr)
36{
39{
37
40
38 setApplicationName(QStringLiteral("unity8"));
41 setApplicationName(QStringLiteral("unity8"));
@@ -116,12 +119,22 @@ ShellApplication::ShellApplication(int & argc, char ** argv, bool isMirServer)
116}
119}
117
120
118ShellApplication::~ShellApplication()
121ShellApplication::~ShellApplication()
122+{
123+ destroyResources();
124+}
125+
126+void ShellApplication::destroyResources()
119{
127{
120 // Deletion order is important. Don't use QScopedPointers and the like
128 // Deletion order is important. Don't use QScopedPointers and the like
121 // Otherwise the process will hang on shutdown (bug somewhere I guess).
129 // Otherwise the process will hang on shutdown (bug somewhere I guess).
122 delete m_shellView;
130 delete m_shellView;
131+ m_shellView = nullptr;
132+
123 delete m_secondaryWindow;
133 delete m_secondaryWindow;
134+ m_secondaryWindow = nullptr;
135+
124 delete m_mouseTouchAdaptor;
136 delete m_mouseTouchAdaptor;
137+ m_mouseTouchAdaptor = nullptr;
125}
138}
126
139
127void ShellApplication::setupQmlEngine(bool isMirServer)
140void ShellApplication::setupQmlEngine(bool isMirServer)
src/ShellApplication.h+1
@@ -34,6 +34,7 @@ public:
34 ShellApplication(int & argc, char ** argv, bool isMirServer);
34 ShellApplication(int & argc, char ** argv, bool isMirServer);
35 virtual ~ShellApplication();
35 virtual ~ShellApplication();
36
36
37+ void destroyResources();
37public Q_SLOTS:
38public Q_SLOTS:
38 // called by qtmir
39 // called by qtmir
39 void onScreenAboutToBeRemoved(QScreen *screen);
40 void onScreenAboutToBeRemoved(QScreen *screen);
src/main.cpp+1−1
@@ -29,7 +29,7 @@ int main(int argc, const char *argv[])
29
29
30 int result = application->exec();
30 int result = application->exec();
31
31
32− delete application;
32+ application->destroyResources();
33
33
34 return result;
34 return result;
35}
35}