aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2016-03-12 16:46:31 +0100
committerBoris Faure <billiob@gmail.com>2016-03-12 16:46:31 +0100
commit175e474983dd96811224e679d4bbd7d8841937bf (patch)
treea5bb3b67268f213e5238545b577e5c89d0b4397a
parentremove duplicate config keys. Closes T3296 (diff)
downloadterminology-175e474983dd96811224e679d4bbd7d8841937bf.tar.gz
add safe guards around term_set_title
Should avoid issues when popup is up while term is being destroyed.
-rw-r--r--src/bin/win.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/bin/win.c b/src/bin/win.c
index df3c234..4eb85f8 100644
--- a/src/bin/win.c
+++ b/src/bin/win.c
@@ -3223,7 +3223,8 @@ term_miniview_toggle(Term *term)
}
static void
-_set_title_ok_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+_set_title_ok_cb(void *data, Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
{
Evas_Object *popup = data;
Term *term = evas_object_data_get(popup, "term");
@@ -3235,12 +3236,18 @@ _set_title_ok_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA
termio_user_title_set(term->termio, title);
evas_object_del(popup);
+ term_unref(term);
}
static void
-_set_title_cancel_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+_set_title_cancel_cb(void *data, Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
{
+ Evas_Object *popup = data;
+ Term *term = evas_object_data_get(popup, "term");
+
evas_object_del(data);
+ term_unref(term);
}
void
@@ -3251,6 +3258,8 @@ term_set_title(Term *term)
EINA_SAFETY_ON_NULL_RETURN(term);
+ term_ref(term);
+
popup = elm_popup_add(term->wn->win);
evas_object_data_set(popup, "term", term);
elm_object_part_text_set(popup, "title,text", _("Set title"));