[meld] Clean up undo handlers when closing a tab (closes bgo#678048)
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Clean up undo handlers when closing a tab (closes bgo#678048)
- Date: Sat, 16 Jun 2012 22:19:56 +0000 (UTC)
commit 2348147babdf1b08361949add7645f2e07e303a3
Author: Kai Willadsen <kai willadsen gmail com>
Date: Thu Jun 14 07:41:36 2012 +1000
Clean up undo handlers when closing a tab (closes bgo#678048)
When the undo handling mechanisms were moved around in commit
c8eb4d65c0bbbf3168250a2672c1f786e650cd67 the tab closing case wasn't
dealt with.
While tab removal does trigger a switch-out, and could theoretically
be handled in the switch-page handler, there's no way to get at the
page being switched from if that page has been removed. Therefore, we
add a simple clean up of the signal handlers in try_remove_page.
meld/meldwindow.py | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/meld/meldwindow.py b/meld/meldwindow.py
index f393655..1bffda0 100644
--- a/meld/meldwindow.py
+++ b/meld/meldwindow.py
@@ -583,13 +583,20 @@ class MeldWindow(gnomeglade.Component):
"See if a page will allow itself to be removed"
response = page.on_delete_event(appquit)
if response != gtk.RESPONSE_CANCEL:
- self.scheduler.remove_scheduler( page.scheduler )
- i = self.notebook.page_num( page.widget )
- assert(i>=0)
- # If the page we're removing is the current page, we need to trigger a switch out
- if self.notebook.get_current_page() == i:
+ self.scheduler.remove_scheduler(page.scheduler)
+ page_num = self.notebook.page_num(page.widget)
+ assert page_num >= 0
+
+ # If the page we're removing is the current page, we need to
+ # disconnect and clear undo handlers, and trigger a switch out
+ if self.notebook.get_current_page() == page_num:
+ page.disconnect(self.diff_handler)
+ for handler in self.undo_handlers:
+ page.undosequence.disconnect(handler)
+ self.undo_handlers = tuple()
page.on_container_switch_out_event(self.ui)
- self.notebook.remove_page(i)
+
+ self.notebook.remove_page(page_num)
if self.notebook.get_n_pages() == 0:
self.widget.set_title("Meld")
return response
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]