Merge lp://qastaging/~mikemc/ubuntuone-control-panel/fix-slow-quit into lp://qastaging/ubuntuone-control-panel
Status: | Merged |
---|---|
Approved by: | Mike McCracken |
Approved revision: | 401 |
Merged at revision: | 397 |
Proposed branch: | lp://qastaging/~mikemc/ubuntuone-control-panel/fix-slow-quit |
Merge into: | lp://qastaging/ubuntuone-control-panel |
Diff against target: |
183 lines (+58/-37) 2 files modified
ubuntuone/controlpanel/gui/qt/main/darwin.py (+14/-3) ubuntuone/controlpanel/gui/qt/main/tests/test_darwin.py (+44/-34) |
To merge this branch: | bzr merge lp://qastaging/~mikemc/ubuntuone-control-panel/fix-slow-quit |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alejandro J. Cura (community) | Approve | ||
dobey (community) | Approve | ||
Review via email:
|
Commit message
- Change quit handler to quit immediately. (LP: #1042834)
Description of the change
- Change quit handler to quit immediately. (LP: #1042834)
Two main changes:
- Ignore ReactorNotRunning when quitting. We want quitting to always work, and if we bail with an exception when trying to tell the reactor to stop, we never do the necessary cleanup later in the function.
I don't completely understand the reasons why we occasionally see this error, but I am confident that it's harmless to ignore and continue on with the quitting.
- Call reactor.iterate() directly. This is called on a timer which can occasionally be scheduled for very far in the future. So, because the qtreactor does not wake when we stop it, it waits for the timer to fire before quitting its event loop and really dying. Since qtreactor doesn't listen for a quit event, we need to call it directly to wake it at the right time.
(also tests updated and simplified using mock.)
TO TEST IRL:
run control-panel, preferably from the terminal with U1_DEBUG=1 wait ~20 seconds after it loads fully, so that the SSO helper process has exited. Sometime shortly after SSO has exited, quit control panel via cmd-q.
- without the direct call to iterate(), control panel will then stall for many seconds before quitting cleanly.
* What's going on? The qtreactor has been told to stop, and is waiting until the next call to iterate() to actually call quit() on the Qapplication instance. A fun thing to do here is to put a print in some Qt event handler, like FoldersPanel.
- with this change, things quit right away.
Good detective work fixing this. +1