prevent traceback when writing in a closed gc control. Fixes #5455

This commit is contained in:
Yann Leboulanger 2009-11-30 14:32:59 +01:00
parent a0fea76ff2
commit badbe820a1
1 changed files with 4 additions and 2 deletions

View File

@ -892,6 +892,8 @@ class HtmlTextView(gtk.TextView):
def on_text_buffer_mark_set(self, location, mark, unused_data): def on_text_buffer_mark_set(self, location, mark, unused_data):
bounds = self.get_buffer().get_selection_bounds() bounds = self.get_buffer().get_selection_bounds()
if bounds: if bounds:
# 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 = self.get_clipboard(gtk.gdk.SELECTION_PRIMARY)
clipboard.set_text(self.get_selected_text()) clipboard.set_text(self.get_selected_text())