[tbo] Fixing text selection seg fault in text tool
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tbo] Fixing text selection seg fault in text tool
- Date: Sat, 30 Mar 2013 12:27:59 +0000 (UTC)
commit cd5df3e672764fb61608f6c5530fe82ef31181b1
Author: Daniel Garcia Moreno <danigm wadobo com>
Date: Sat Mar 30 13:27:04 2013 +0100
Fixing text selection seg fault in text tool
src/tbo-tool-text.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/src/tbo-tool-text.c b/src/tbo-tool-text.c
index 7442c70..fd5c24e 100644
--- a/src/tbo-tool-text.c
+++ b/src/tbo-tool-text.c
@@ -292,11 +292,21 @@ tbo_tool_text_get_font_name (TboToolText *self)
void
tbo_tool_text_set_selected (TboToolText *self, TboObjectText *text)
{
- char *str = tbo_object_text_get_text (text);
- self->text_selected = NULL;
+ char *str;
+
+ if (self->text_selected) {
+ g_object_unref (self->text_selected);
+ self->text_selected = NULL;
+ }
+
+ if (!text) {
+ return;
+ }
+
+ str = tbo_object_text_get_text (text);
+
gtk_font_button_set_font_name (GTK_FONT_BUTTON (self->font), tbo_object_text_get_string (text));
gtk_color_button_set_color (GTK_COLOR_BUTTON (self->font_color), text->font_color);
gtk_text_buffer_set_text (self->text_buffer, str, -1);
- self->text_selected = text;
+ self->text_selected = g_object_ref (text);
}
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]