@@ -74,7 +74,7 @@ ShellApplication::ShellApplication(int & argc, char ** argv, bool isMirServer)
7474 bindtextdomain("unity8", translationDirectory().toUtf8().data());
7575 textdomain("unity8");
7676
77− m_shellView.reset(new ShellView(m_qmlEngine, &m_qmlArgs));
77+ m_shellView = new ShellView(m_qmlEngine, &m_qmlArgs);
7878
7979 if (parser.windowGeometry().isValid()) {
8080 m_shellView->setWidth(parser.windowGeometry().width());
@@ -88,7 +88,7 @@ ShellApplication::ShellApplication(int & argc, char ** argv, bool isMirServer)
8888 // You will need this if you want to interact with touch-only components using a mouse
8989 // Needed only when manually testing on a desktop.
9090 if (parser.hasMouseToTouch()) {
91− m_mouseTouchAdaptor.reset(MouseTouchAdaptor::instance());
91+ m_mouseTouchAdaptor = MouseTouchAdaptor::instance();
9292 }
9393
9494
@@ -101,7 +101,7 @@ ShellApplication::ShellApplication(int & argc, char ** argv, bool isMirServer)
101101 m_shellView->setScreen(screens().at(1));
102102 m_qmlArgs.setDeviceName("desktop");
103103
104− m_secondaryWindow.reset(new SecondaryWindow(m_qmlEngine));
104+ m_secondaryWindow = new SecondaryWindow(m_qmlEngine);
105105 m_secondaryWindow->setScreen(screens().at(0));
106106 // QWindow::showFullScreen() also calls QWindow::requestActivate() and we don't want that!
107107 m_secondaryWindow->setWindowState(Qt::WindowFullScreen);
@@ -115,6 +115,15 @@ ShellApplication::ShellApplication(int & argc, char ** argv, bool isMirServer)
115115 }
116116}
117117
118+ShellApplication::~ShellApplication()
119+{
120+ // Deletion order is important. Don't use QScopedPointers and the like
121+ // Otherwise the process will hang on shutdown (bug somewhere I guess).
122+ delete m_shellView;
123+ delete m_secondaryWindow;
124+ delete m_mouseTouchAdaptor;
125+}
126+
118127void ShellApplication::setupQmlEngine(bool isMirServer)
119128{
120129 m_qmlEngine = new QQmlEngine(this);
@@ -143,7 +152,7 @@ void ShellApplication::onScreenAdded(QScreen * /*screen*/)
143152 // its backing QPlatformWindow recreated). So lets refocus it.
144153 m_shellView->requestActivate();
145154
146− m_secondaryWindow.reset(new SecondaryWindow(m_qmlEngine));
155+ m_secondaryWindow = new SecondaryWindow(m_qmlEngine);
147156 m_secondaryWindow->setScreen(screens().at(0));
148157
149158 // QWindow::showFullScreen() also calls QWindow::requestActivate() and we don't want that!
@@ -159,8 +168,9 @@ void ShellApplication::onScreenAboutToBeRemoved(QScreen *screen)
159168 if (screen == m_shellView->screen()) {
160169 Q_ASSERT(screens().count() > 1);
161170 Q_ASSERT(screens().at(0) != screen);
162− Q_ASSERT(!m_secondaryWindow.isNull());
163− m_secondaryWindow.reset();
171+ Q_ASSERT(m_secondaryWindow);
172+ delete m_secondaryWindow;
173+ m_secondaryWindow = nullptr;
164174 m_shellView->setScreen(screens().first());
165175 m_qmlArgs.setDeviceName(m_deviceName);
166176 // Changing the QScreen where a QWindow is drawn makes it also lose focus (besides having