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,8 +892,10 @@ 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:
clipboard = self.get_clipboard(gtk.gdk.SELECTION_PRIMARY) # textview can be hidden while we add a new line in it.
clipboard.set_text(self.get_selected_text()) if self.has_screen():
clipboard = self.get_clipboard(gtk.gdk.SELECTION_PRIMARY)
clipboard.set_text(self.get_selected_text())
def get_selected_text(self): def get_selected_text(self):
bounds = self.get_buffer().get_selection_bounds() bounds = self.get_buffer().get_selection_bounds()