UI does not update after credentials RPC on darwin

Bug #1015825 reported by Mike McCracken
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu One Control Panel
Status tracked in Trunk
Stable-4-0
Fix Released
Undecided
Unassigned
Trunk
Fix Released
High
Mike McCracken

Bug Description

running control panel will show UI and make an RPC call to SSO client to get credentials, but after that call returns the UI is frozen and no progress is made.

The application is not totally frozen however, qevents are still being sent, but nothing is updating.

Cause:
   In bin/ubuntuone-control-panel-qt, we are installing the qt4
   reactor before we have created a QApplication() instance (via the
   UniqueApplication subclass), so qt4reactor is helpfully creating an
   instance for us. Unfortunately, it creates a QCoreApplication,
   which doesn't update the UI.

 Complication:
 We can't just reorder these, because
 importing ubuntuone.controlpanel.gui.qt.uniqueapp.UniqueApplication
 brings a lot with it, eventually including ubuntuone.platform.ipc,
 and ubuntu_sso.utils.tcpactivation, which ends up creating a default
 reactor, and we get a "reactor already installed" error, as seen in
 bug 942655. (I'm not sure why the code that works on Windows doesn't
 work on darwin.)

This means that small changes that just change the order of
qt4reactor.install() and UniqueApplication.__init__() won't work,
because of the import dependencies.

Tags: u1-darwin

Related branches

Mike McCracken (mikemc)
Changed in ubuntuone-control-panel:
assignee: nobody → Mike McCracken (mikemc)
Revision history for this message
Mike McCracken (mikemc) wrote :

One way to fix this is to change qt4reactor to let us pass in whether we want a QApplication or QCoreApplication.
However, it seems better to try to fix this in our own code instead of worrying about patches to other code.

Another way is to move UniqueApplication up out of the controlpanel/gui/ tree.
This way it won't import all that crap it doesn't need before it can initialize the QApplication instance.
Then we can create the UniqueApplication in the toplevel script before any reactors are created.
I've done this by changing main.main() to take the app instead of argv.

I've tried this - I moved ubuntuone/controlpanel/gui/qt/uniqueapp/ to ubuntuone/controlpanel/uniqueapp, and it works on darwin, but it needs fixes for the tests in controlpanel/gui/qt/main/tests/test_main.py because I'm now passing the app to main instead of argv.

I'm noting all this before I make those test changes because I'm curious if anyone has objections to the change.
See the linked branch to see what I've done so far.

Revision history for this message
Mike McCracken (mikemc) wrote :

comment 1 refers to an attached branch that has been removed.

We decided on a third approach to fix this - change tcpactivation over in ubuntu_sso to avoid importing twisted.internet.reactor upon import, which breaks the cycle by letting us import UniqueApplication from where it is now without installing the default reactor. (see Bug #1017672)

Then the only change required in this branch is to move the code that installs the qt4reactor into main(), after the UniqueApplication instance is created.

Changed in ubuntuone-control-panel:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.