aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--widgets/misc/e-canvas.c2
-rw-r--r--widgets/text/e-text.c21
-rw-r--r--widgets/text/e-text.h2
3 files changed, 24 insertions, 1 deletions
diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c
index e48c6bb821..fea3746ce1 100644
--- a/widgets/misc/e-canvas.c
+++ b/widgets/misc/e-canvas.c
@@ -139,6 +139,8 @@ e_canvas_destroy (GtkObject *object)
canvas->toplevel = NULL;
}
+ e_canvas_hide_tooltip(canvas);
+
if ((GTK_OBJECT_CLASS (parent_class))->destroy)
(*(GTK_OBJECT_CLASS (parent_class))->destroy) (object);
}
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c
index fadb390c4f..d838518d5f 100644
--- a/widgets/text/e-text.c
+++ b/widgets/text/e-text.c
@@ -354,7 +354,7 @@ e_text_init (EText *text)
{
text->model = e_text_model_new ();
text->text = e_text_model_get_text (text->model);
-
+
gtk_object_ref (GTK_OBJECT (text->model));
gtk_object_sink (GTK_OBJECT (text->model));
@@ -420,6 +420,7 @@ e_text_init (EText *text)
text->tooltip_timeout = 0;
text->tooltip_count = 0;
+ text->tooltip_owner = FALSE;
text->dbl_timeout = 0;
text->tpl_timeout = 0;
@@ -445,6 +446,10 @@ e_text_destroy (GtkObject *object)
text = E_TEXT (object);
+ if (text->tooltip_owner) {
+ e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(text)->canvas));
+ }
+
if (text->model_changed_signal_id)
gtk_signal_disconnect (GTK_OBJECT (text->model),
text->model_changed_signal_id);
@@ -2682,6 +2687,9 @@ static gboolean
tooltip_event(GtkWidget *tooltip, GdkEvent *event, EText *text)
{
gint ret_val = FALSE;
+ if (GTK_OBJECT_DESTROYED (text)) {
+ return FALSE;
+ }
switch (event->type) {
case GDK_LEAVE_NOTIFY:
e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(text)->canvas));
@@ -2703,6 +2711,13 @@ tooltip_event(GtkWidget *tooltip, GdkEvent *event, EText *text)
return ret_val;
}
+static void
+tooltip_destroy(GtkWidget *tooltip, EText *text)
+{
+ text->tooltip_owner = FALSE;
+ gtk_object_unref (GTK_OBJECT (text));
+}
+
static gboolean
_do_tooltip (gpointer data)
{
@@ -2883,11 +2898,15 @@ _do_tooltip (gpointer data)
gtk_widget_realize (tooltip_window);
gtk_signal_connect (GTK_OBJECT(tooltip_window), "event",
GTK_SIGNAL_FUNC(tooltip_event), text);
+ gtk_signal_connect (GTK_OBJECT(tooltip_window), "destroy",
+ GTK_SIGNAL_FUNC(tooltip_destroy), text);
+ gtk_object_ref (GTK_OBJECT (text));
e_canvas_popup_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(text)->canvas),
tooltip_window,
pixel_origin.x - 2 + tooltip_x,
pixel_origin.y - 2 + tooltip_y);
+ text->tooltip_owner = TRUE;
text->tooltip_timeout = 0;
return FALSE;
diff --git a/widgets/text/e-text.h b/widgets/text/e-text.h
index dfb25d21b5..b3126bf291 100644
--- a/widgets/text/e-text.h
+++ b/widgets/text/e-text.h
@@ -206,6 +206,8 @@ struct _EText {
guint bold : 1;
guint strikeout : 1;
+ guint tooltip_owner : 1;
+
EFontStyle style;
gchar *break_characters; /* Characters to optionally break after */