Merge lp:~unity-team/qtmir/ghostApps-preemptQuitters into lp:qtmir

Proposed by Gerry Boland on 2015-08-21
Status: Merged
Approved by: Daniel d'Andrada on 2015-08-21
Approved revision: 370
Merged at revision: 367
Proposed branch: lp:~unity-team/qtmir/ghostApps-preemptQuitters
Merge into: lp:qtmir
Prerequisite: lp:~dandrader/qtmir/ghostApps
Diff against target: 49 lines (+21/-0)
2 files modified
src/modules/Unity/Application/application_manager.cpp (+19/-0)
src/modules/Unity/Application/application_manager.h (+2/-0)
To merge this branch: bzr merge lp:~unity-team/qtmir/ghostApps-preemptQuitters
Reviewer Review Type Date Requested Status
Daniel d'Andrada (community) 2015-08-21 Approve on 2015-08-21
PS Jenkins bot continuous-integration 2015-08-21 Approve on 2015-08-21
Review via email: mp+268737@code.launchpad.net

This proposal supersedes a proposal from 2015-08-21.

Commit Message

AppMan: if app destroys surface while in Running state, it is probably shutting down, so preempt it by removing it from the model

Description of the Change

AppMan: if app destroys surface while in Running state, it is probably shutting down, so preempt it by removing it from the model

To post a comment you must log in.
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Gerry Boland (gerboland) wrote : Posted in a previous version of this proposal

This could result in processes hanging around. If app decides to destroy its window, with this patch, appMan stops listing it. But that app could keep running in the background, and user has no way of knowing and no way of stopping that.

One idea would be on surface destrction, start a timer for 5 seconds, after which we ensure the process is dead, or have it killed.

Daniel d'Andrada (dandrader) wrote :

I think the intelligence should remain all in Application, with ApplicationManager being solely a demultiplexer of signals to Applications.

Daniel d'Andrada (dandrader) wrote :

But since this is an emergency, I'm ok with having it for now.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/modules/Unity/Application/application_manager.cpp'
2--- src/modules/Unity/Application/application_manager.cpp 2015-08-21 11:36:11 +0000
3+++ src/modules/Unity/Application/application_manager.cpp 2015-08-21 11:36:11 +0000
4@@ -82,6 +82,8 @@
5 manager, &ApplicationManager::onSessionStopping);
6 QObject::connect(listener, &SessionListener::sessionCreatedSurface,
7 manager, &ApplicationManager::onSessionCreatedSurface);
8+ QObject::connect(listener, &SessionListener::sessionDestroyingSurface,
9+ manager, &ApplicationManager::onSessionDestroyingSurface);
10 }
11
12 void connectToSessionAuthorizer(ApplicationManager *manager, SessionAuthorizer *authorizer)
13@@ -671,6 +673,23 @@
14 }
15 }
16
17+void ApplicationManager::onSessionDestroyingSurface(ms::Session const* session,
18+ std::shared_ptr<ms::Surface> const& surface)
19+{
20+ qCDebug(QTMIR_APPLICATIONS) << "ApplicationManager::onSessionDestroyingSurface - sessionName=" << session->name().c_str();
21+ Q_UNUSED(surface);
22+
23+ Application* application = findApplicationWithSession(session);
24+ if (application && application->state() == Application::Running) {
25+ // If app in Running state but it destroys its surface, it's probably shutting down,
26+ // in which case, we can preempt it and remove it from the App list immediately.
27+ // FIXME: this is not desktop application friendly, but resolves issue where trust-prompt
28+ // helpers take a long time to shut down, but destroys their surface quickly.
29+ remove(application);
30+ application->deleteLater();
31+ }
32+}
33+
34 Application* ApplicationManager::findApplicationWithSession(const std::shared_ptr<ms::Session> &session)
35 {
36 return findApplicationWithSession(session.get());
37
38=== modified file 'src/modules/Unity/Application/application_manager.h'
39--- src/modules/Unity/Application/application_manager.h 2015-05-27 21:07:45 +0000
40+++ src/modules/Unity/Application/application_manager.h 2015-08-21 11:36:11 +0000
41@@ -121,6 +121,8 @@
42 void onSessionStopping(std::shared_ptr<mir::scene::Session> const& session);
43
44 void onSessionCreatedSurface(mir::scene::Session const*, std::shared_ptr<mir::scene::Surface> const&);
45+ void onSessionDestroyingSurface(mir::scene::Session const* session,
46+ std::shared_ptr<mir::scene::Surface> const& surface);
47
48 void onProcessStarting(const QString& appId);
49 void onProcessStopped(const QString& appId);

Subscribers

People subscribed via source and target branches