From b9965dc75c77c086b9fa423c5a2bf61e9e72544f Mon Sep 17 00:00:00 2001 From: Anna Date: Thu, 22 Apr 2010 15:13:49 -0400 Subject: [PATCH] Added a little locking, seems to have fixed the segmentation fault --- apithreads.py | 7 ++++++- mytwitter.py | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/apithreads.py b/apithreads.py index b0fcb56..5eded11 100644 --- a/apithreads.py +++ b/apithreads.py @@ -1,6 +1,7 @@ # Python module that handles calls to the twitter API as a separate thread import re +import gtk from threading import Thread class GetTweets(Thread): @@ -44,7 +45,11 @@ class GetTweets(Thread): else: statuses = results_to_statuses(self.api.Search(self.list_name, rpp=self.num_entries)) - self.pane.update_window(statuses) + gtk.gdk.threads_enter() + try: + self.pane.update_window(statuses) + finally: + gtk.gdk.threads_leave() print 'debug: GetTweets.run(): finished' diff --git a/mytwitter.py b/mytwitter.py index 0d8c342..c381f6a 100755 --- a/mytwitter.py +++ b/mytwitter.py @@ -446,5 +446,6 @@ parser.add_option('-c' ,'--config', dest="filename", default="~/.mytwitter.conf" (options, args) = parser.parse_args() my_twitter = MyTwitter(options.filename) + gtk.gdk.threads_init() gtk.main()