From badbe820a1a3f116d56235507d42228d949bea92 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Mon, 30 Nov 2009 14:32:59 +0100 Subject: [PATCH] prevent traceback when writing in a closed gc control. Fixes #5455 --- src/htmltextview.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/htmltextview.py b/src/htmltextview.py index 8b65d8f87..11b69e4b6 100644 --- a/src/htmltextview.py +++ b/src/htmltextview.py @@ -892,8 +892,10 @@ class HtmlTextView(gtk.TextView): def on_text_buffer_mark_set(self, location, mark, unused_data): bounds = self.get_buffer().get_selection_bounds() if bounds: - clipboard = self.get_clipboard(gtk.gdk.SELECTION_PRIMARY) - clipboard.set_text(self.get_selected_text()) + # textview can be hidden while we add a new line in it. + if self.has_screen(): + clipboard = self.get_clipboard(gtk.gdk.SELECTION_PRIMARY) + clipboard.set_text(self.get_selected_text()) def get_selected_text(self): bounds = self.get_buffer().get_selection_bounds()