Merge lp:~alecu/ubuntu-sso-client/fix-100pct-links into lp:ubuntu-sso-client

Proposed by Alejandro J. Cura
Status: Merged
Approved by: Natalia Bidart
Approved revision: 643
Merged at revision: 641
Proposed branch: lp:~alecu/ubuntu-sso-client/fix-100pct-links
Merge into: lp:ubuntu-sso-client
Diff against target: 48 lines (+9/-17)
1 file modified
bin/ubuntu-sso-login (+9/-17)
To merge this branch: bzr merge lp:~alecu/ubuntu-sso-client/fix-100pct-links
Reviewer Review Type Date Requested Status
Natalia Bidart (community) Approve
Rodrigo Moya (community) Approve
Review via email: mp+37655@code.launchpad.net

Commit message

Replace twisted gtk reactor with the standard gtk mainloop. (LP: #655327)

Description of the change

The twisted gtk reactor was being installed and used as the mainloop, even though twisted was not used (only trial is used for the tests). I've replaced this with the standard gtk main loop, and the webkit 100% usage issue is now gone.

For the record: pygtkwebkit + twisted gtk reactor somehow do not play nicely with each other.

To post a comment you must log in.
Revision history for this message
Alejandro J. Cura (alecu) wrote :

In order to test this, when the sso registration dialog shows up, click on the Terms and Conditions button, and then click on some of the links of the T&C page that is shown inside the dialog. The linked page should open in your default browser, and the CPU usage of ubuntu-sso-client should not grow to 100%.

Revision history for this message
Rodrigo Moya (rodrigo-moya) :
review: Approve
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

The sighup_handler must not be removed, we should be able to stop the service somehow. We should replace the reactor.run with gtk.main_quit

review: Needs Fixing
643. By Alejandro J. Cura

restoring sighup handler to log when stopping

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Much better!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/ubuntu-sso-login'
2--- bin/ubuntu-sso-login 2010-09-30 21:18:40 +0000
3+++ bin/ubuntu-sso-login 2010-10-06 16:44:21 +0000
4@@ -62,16 +62,15 @@
5
6
7 def sighup_handler(*a, **kw):
8- """Stop the service.
9-
10- This is not thread safe, see the link below for info:
11- www.listware.net/201004/gtk-devel-list/115067-unix-signals-in-glib.html
12- """
13- from twisted.internet import reactor
14- # Module 'twisted.internet.reactor' has no 'stop' member
15- # pylint: disable=E1101
16+ """Stop the service."""
17+ # This handler may be called in any thread, so is not thread safe.
18+ # See the link below for info:
19+ # www.listware.net/201004/gtk-devel-list/115067-unix-signals-in-glib.html
20+ #
21+ # gtk.main_quit and the logger methods are safe to be called from any thread.
22+ # Just don't call other random stuff here.
23 logger.info("Stoping Ubuntu SSO login manager since SIGHUP was received.")
24- reactor.stop()
25+ gtk.main_quit()
26
27
28 if __name__ == "__main__":
29@@ -83,10 +82,6 @@
30 logger.error("Ubuntu SSO login manager already running, quitting.")
31 sys.exit(0)
32
33- logger.debug("Installing the Twisted gtk2reactor.")
34- from twisted.internet import gtk2reactor
35- gtk2reactor.install()
36-
37 logger.debug("Hooking up SIGHUP with handler %r.", sighup_handler)
38 signal.signal(signal.SIGHUP, sighup_handler)
39
40@@ -97,7 +92,4 @@
41 bus=dbus.SessionBus()),
42 object_path=DBUS_CRED_PATH)
43
44- from twisted.internet import reactor
45- # Module 'twisted.internet.reactor' has no 'run' member
46- # pylint: disable=E1101
47- reactor.run()
48+ gtk.main()

Subscribers

People subscribed via source and target branches