Merge lp:~dobey/gwibber/gwibber-keyring-unthreaded into lp:gwibber

Proposed by dobey
Status: Rejected
Rejected by: Ken VanDine
Proposed branch: lp:~dobey/gwibber/gwibber-keyring-unthreaded
Merge into: lp:gwibber
Diff against target: 50 lines (+3/-8)
2 files modified
bin/gwibber-service (+0/-2)
gwibber/microblog/dispatcher.py (+3/-6)
To merge this branch: bzr merge lp:~dobey/gwibber/gwibber-keyring-unthreaded
Reviewer Review Type Date Requested Status
Ken VanDine Disapprove
Review via email: mp+22704@code.launchpad.net

This proposal supersedes a proposal from 2010-03-31.

To post a comment you must log in.
Revision history for this message
dobey (dobey) wrote :

It appears that the association to gnome-keyring for this issue in gwibber is only somewhat incidental. The Dispatcher class in gwibber was mixing Threads and the gobject main loop with out mutex locking or any means of protecting against thread locks. There's really no good reason to derive the Dispatcher class from threading.Thread anyway, so I've just removed it instead.

If you want to re-introduce the use of threading.Thread here though, you should implement proper entry/exit to the main loop for calling gobject things (like idle_add/timeout_add*). And you should probably do it via a more generic class which all your dbus.Object implementations derive from (so that they are all separate threads).

Revision history for this message
Ken VanDine (ken-vandine) wrote :

Partially used, thanks!

review: Disapprove

Unmerged revisions

705. By dobey

Remove the use of Thread from the Dispatcher

704. By dobey

Use the with statement and gtk main loop lock to call gnomekeyring with

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/gwibber-service'
--- bin/gwibber-service 2010-03-11 20:05:07 +0000
+++ bin/gwibber-service 2010-04-02 15:48:19 +0000
@@ -80,6 +80,4 @@
80log.logger.debug("Monitors are up")80log.logger.debug("Monitors are up")
8181
82dispatcher = dispatcher.Dispatcher(loop)82dispatcher = dispatcher.Dispatcher(loop)
83dispatcher.daemon = True
84dispatcher.start()
85loop.run()83loop.run()
8684
=== modified file 'gwibber/microblog/dispatcher.py'
--- gwibber/microblog/dispatcher.py 2010-03-31 16:51:12 +0000
+++ gwibber/microblog/dispatcher.py 2010-04-02 15:48:19 +0000
@@ -24,8 +24,6 @@
24except:24except:
25 indicate = None25 indicate = None
2626
27gobject.threads_init()
28
29log.logger.name = "Gwibber Dispatcher"27log.logger.name = "Gwibber Dispatcher"
3028
31PROTOCOLS = {29PROTOCOLS = {
@@ -54,8 +52,8 @@
54 if isinstance(val, str) and val.startswith(":KEYRING:"):52 if isinstance(val, str) and val.startswith(":KEYRING:"):
55 try:53 try:
56 value = gnomekeyring.find_items_sync(54 value = gnomekeyring.find_items_sync(
57 gnomekeyring.ITEM_GENERIC_SECRET,55 gnomekeyring.ITEM_GENERIC_SECRET,
58 {"id": str("%s/%s" % (account["_id"], key))})[0].secret56 {"id": str("%s/%s" % (account["_id"], key))})[0].secret
59 except gnomekeyring.NoMatchError:57 except gnomekeyring.NoMatchError:
60 raise exceptions.GwibberProtocolError("keyring")58 raise exceptions.GwibberProtocolError("keyring")
61 return ("Failure", 0)59 return ("Failure", 0)
@@ -345,7 +343,7 @@
345 except Exception as e:343 except Exception as e:
346 self.failure(e, traceback.format_exc())344 self.failure(e, traceback.format_exc())
347345
348class Dispatcher(dbus.service.Object, threading.Thread):346class Dispatcher(dbus.service.Object):
349 """347 """
350 The Gwibber Dispatcher handles all the backend operations.348 The Gwibber Dispatcher handles all the backend operations.
351 """349 """
@@ -355,7 +353,6 @@
355 self.bus = dbus.SessionBus()353 self.bus = dbus.SessionBus()
356 bus_name = dbus.service.BusName("com.Gwibber.Service", bus=self.bus)354 bus_name = dbus.service.BusName("com.Gwibber.Service", bus=self.bus)
357 dbus.service.Object.__init__(self, bus_name, self.__dbus_object_path__)355 dbus.service.Object.__init__(self, bus_name, self.__dbus_object_path__)
358 threading.Thread.__init__(self)
359 356
360 self.collector = OperationCollector()357 self.collector = OperationCollector()
361358

Subscribers

People subscribed via source and target branches