Skip to content

Commit

Permalink
Avoid early deletion/collection of gPodderWelcome (bug 1021)
Browse files Browse the repository at this point in the history
The gPodderWelcome Python object was deleted and/or collected
after it fell out of scope, while the Gtk dialog was still
displayed. Work around this by running a separate main loop
for the dialog, so that the Python object stays alive longer.

This bug has been haunting us for quite some time now, and it
seems like the object hasn't always been collected, making it
harder to track down the bug. But rejoice, we finally fixed it!
  • Loading branch information
thp committed Oct 19, 2011
1 parent 5fd56b6 commit f47f48a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
13 changes: 7 additions & 6 deletions src/gpodder/gtkui/interface/welcome.py
Expand Up @@ -26,6 +26,9 @@
from gpodder.gtkui.interface.common import BuilderWidget

class gPodderWelcome(BuilderWidget):
RESPONSE_OPML = 1
RESPONSE_MYGPO = 2

finger_friendly_widgets = ['btnOPML', 'btnMygPodder', 'btnCancel']

def new(self):
Expand All @@ -40,16 +43,14 @@ def new(self):
self.btnOPML.set_name('HildonButton-thumb')
self.btnMygPodder.set_name('HildonButton-thumb')

self.gPodderWelcome.show()
self.main_window.show()

def on_show_example_podcasts(self, button):
self.gPodderWelcome.destroy()
self.show_example_podcasts_callback(None)
self.main_window.response(self.RESPONSE_OPML)

def on_setup_my_gpodder(self, gpodder):
self.gPodderWelcome.destroy()
self.setup_my_gpodder_callback(None)
self.main_window.response(self.RESPONSE_MYGPO)

def on_btnCancel_clicked(self, button):
self.gPodderWelcome.destroy()
self.main_window.response(gtk.RESPONSE_CANCEL)

14 changes: 11 additions & 3 deletions src/gpodder/gui.py
Expand Up @@ -592,7 +592,7 @@ def on_resume_all(button):

# First-time users should be asked if they want to see the OPML
if not self.channels and not gpodder.ui.fremantle:
util.idle_add(self.on_itemUpdate_activate)
self.on_itemUpdate_activate()

def episode_object_by_uri(self, uri):
"""Get an episode object given a local or remote URI
Expand Down Expand Up @@ -3346,11 +3346,19 @@ def on_itemUpdate_activate(self, widget=None):
if self.channels:
self.update_feed_cache()
else:
gPodderWelcome(self.gPodder,
center_on_widget=self.gPodder,
welcome_window = gPodderWelcome(self.main_window,
center_on_widget=self.main_window,
show_example_podcasts_callback=self.on_itemImportChannels_activate,
setup_my_gpodder_callback=self.on_download_subscriptions_from_mygpo)

result = welcome_window.main_window.run()

welcome_window.main_window.destroy()
if result == gPodderWelcome.RESPONSE_OPML:
self.on_itemImportChannels_activate(None)
elif result == gPodderWelcome.RESPONSE_MYGPO:
self.on_download_subscriptions_from_mygpo(None)

def download_episode_list_paused(self, episodes):
self.download_episode_list(episodes, True)

Expand Down

0 comments on commit f47f48a

Please sign in to comment.