From c3382861957fba9d785aa2fec329a63b0cde6c09 Mon Sep 17 00:00:00 2001 From: Boris Faure Date: Tue, 25 Feb 2020 20:54:24 +0100 Subject: [PATCH] win: ensure the term has a container when dragging it --- src/bin/win.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/bin/win.c b/src/bin/win.c index d0f1cb1d..9fa8b49d 100644 --- a/src/bin/win.c +++ b/src/bin/win.c @@ -3272,6 +3272,12 @@ _tab_drag_start(void *data EINA_UNUSED) Term *term = _tab_drag->term; Evas_Object *o = elm_layout_add(term->bg); + if (!term->container) + { + _tab_drag_free(); + return ECORE_CALLBACK_CANCEL; + } + theme_apply_elm(o, term->config, "terminology/tabbar_back"); elm_layout_text_set(o, "terminology.title", term->container->title); @@ -3305,8 +3311,11 @@ _tabs_mouse_down( /* Launch a timer to start drag animation */ Term *term = data; Evas_Coord mx = 0, my = 0; - _tab_drag = calloc(1, sizeof(*_tab_drag)); + assert(term->container != NULL); + assert(_tab_drag == NULL); + + _tab_drag = calloc(1, sizeof(*_tab_drag)); if (!_tab_drag) return; @@ -3319,7 +3328,7 @@ _tabs_mouse_down( _tab_drag->mdy = my; _tab_drag->term = term; _tab_drag->timer = ecore_timer_add(DRAG_TIMEOUT, - _tab_drag_start, NULL); + _tab_drag_start, NULL); } @@ -6191,6 +6200,10 @@ main_config_sync(const Config *config) static void _term_free(Term *term) { + if (_tab_drag && _tab_drag->term == term) + { + _tab_drag_free(); + } if (term->sendfile_request) { evas_object_del(term->sendfile_request);