billiob pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=a07a63048c186780f83486c25f6c593165eee396

commit a07a63048c186780f83486c25f6c593165eee396
Author: Boris Faure <bill...@gmail.com>
Date:   Thu Jun 11 23:55:35 2015 +0200

    fix crash from object being swallowed twice. Closes T2463
---
 src/bin/termio.c | 33 +++++++++++++++++++++++++++++++++
 src/bin/win.c    | 48 +++++++++++++++++++++++++++---------------------
 2 files changed, 60 insertions(+), 21 deletions(-)

diff --git a/src/bin/termio.c b/src/bin/termio.c
index f924a5b..e42f6a4 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -5311,6 +5311,39 @@ _smart_pty_cancel_sel(void *data)
 static void
 _smart_pty_exited(void *data)
 {
+   Termio *sd = evas_object_smart_data_get(data);
+
+   if (sd->event)
+     {
+        evas_object_event_callback_del(sd->event, EVAS_CALLBACK_MOUSE_DOWN,
+                                       _smart_cb_mouse_down);
+        evas_object_event_callback_del(sd->event, EVAS_CALLBACK_MOUSE_UP,
+                                       _smart_cb_mouse_up);
+        evas_object_event_callback_del(sd->event, EVAS_CALLBACK_MOUSE_MOVE,
+                                       _smart_cb_mouse_move);
+        evas_object_event_callback_del(sd->event, EVAS_CALLBACK_MOUSE_IN,
+                                       _smart_cb_mouse_in);
+        evas_object_event_callback_del(sd->event, EVAS_CALLBACK_MOUSE_OUT,
+                                       _smart_cb_mouse_out);
+        evas_object_event_callback_del(sd->event, EVAS_CALLBACK_MOUSE_WHEEL,
+                                       _smart_cb_mouse_wheel);
+
+        evas_object_del(sd->event);
+        sd->event = NULL;
+     }
+   if (sd->self)
+     {
+        evas_object_event_callback_del(sd->self, EVAS_CALLBACK_KEY_DOWN,
+                                       _smart_cb_key_down);
+        evas_object_event_callback_del(sd->self, EVAS_CALLBACK_KEY_UP,
+                                       _smart_cb_key_up);
+        evas_object_event_callback_del(sd->self, EVAS_CALLBACK_FOCUS_IN,
+                                       _smart_cb_focus_in);
+        evas_object_event_callback_del(sd->self, EVAS_CALLBACK_FOCUS_OUT,
+                                       _smart_cb_focus_out);
+        sd->self = NULL;
+     }
+
    evas_object_smart_callback_call(data, "exited", NULL);
 }
 
diff --git a/src/bin/win.c b/src/bin/win.c
index 8b6b5c9..c94c2c0 100644
--- a/src/bin/win.c
+++ b/src/bin/win.c
@@ -161,11 +161,11 @@ static void _tabs_refresh(Tabs *tabs);
 /* {{{ Solo */
 
 static Evas_Object *
-_solo_get_evas_object(Term_Container *container)
+_solo_get_evas_object(Term_Container *tc)
 {
    Solo *solo;
-   assert (container->type == TERM_CONTAINER_TYPE_SOLO);
-   solo = (Solo*)container;
+   assert (tc->type == TERM_CONTAINER_TYPE_SOLO);
+   solo = (Solo*) tc;
 
    return solo->term->bg;
 }
@@ -782,7 +782,6 @@ _win_swallow(Term_Container *tc, Term_Container *orig,
    Win *wn;
    Evas_Object *base;
    Evas_Object *o;
-   Evas_Coord x, y, w, h;
 
    assert (tc->type == TERM_CONTAINER_TYPE_WIN);
 
@@ -791,16 +790,13 @@ _win_swallow(Term_Container *tc, Term_Container *orig,
 
    if (orig)
      {
-        o = edje_object_part_swallow_get(base, "terminology.content");
-        edje_object_part_unswallow(base, o);
-        evas_object_hide(o);
         o = orig->get_evas_object(orig);
-        evas_object_geometry_get(o, &x, &y, &w, &h);
+        edje_object_part_unswallow(base, o);
      }
+
    o = new_child->get_evas_object(new_child);
    edje_object_part_swallow(base, "terminology.content", o);
-   if (orig)
-     evas_object_geometry_set(o, x, y, w, h);
+
    evas_object_show(o);
    new_child->parent = tc;
    wn->child = new_child;
@@ -893,8 +889,9 @@ _win_split(Term_Container *tc, Term_Container *child, const 
char *cmd,
    Term *tm_new, *tm;
    Term_Container *tc_split, *tc_solo_new;
    Win *wn;
-   Evas_Object *obj_split;
    char buf[PATH_MAX], *wdir = NULL;
+   Evas_Object *base;
+   Evas_Object *o;
 
    assert (tc->type == TERM_CONTAINER_TYPE_WIN);
    wn = (Win*) tc;
@@ -908,14 +905,14 @@ _win_split(Term_Container *tc, Term_Container *child, 
const char *cmd,
    tc_solo_new = _solo_new(tm_new, wn);
    evas_object_data_set(tm_new->termio, "sizedone", tm_new->termio);
 
-   tc_split = _split_new(child, tc_solo_new, is_horizontal);
+   base = win_base_get(wn);
+   o = child->get_evas_object(child);
+   edje_object_part_unswallow(base, o);
 
-   obj_split = tc_split->get_evas_object(tc_split);
+   tc_split = _split_new(child, tc_solo_new, is_horizontal);
 
    tc_split->is_focused = tc->is_focused;
-   tc->swallow(tc, child, tc_split);
-
-   evas_object_show(obj_split);
+   tc->swallow(tc, NULL, tc_split);
 }
 
 static void
@@ -1173,7 +1170,6 @@ _split_swallow(Term_Container *tc, Term_Container *orig,
 {
    Split *split;
    Evas_Object *o;
-   Evas_Coord x, y, w, h;
 
    assert (tc->type == TERM_CONTAINER_TYPE_SPLIT);
    split = (Split*) tc;
@@ -1181,7 +1177,6 @@ _split_swallow(Term_Container *tc, Term_Container *orig,
    assert (orig && (orig == split->tc1 || orig == split->tc2));
 
    o = orig->get_evas_object(orig);
-   evas_object_geometry_get(o, &x, &y, &w, &h);
    evas_object_hide(o);
 
    if (orig == split->last_focus)
@@ -1201,7 +1196,6 @@ _split_swallow(Term_Container *tc, Term_Container *orig,
         split->tc2 = new_child;
      }
    new_child->parent = tc;
-   evas_object_geometry_set(o, x, y, w, h);
    evas_object_show(o);
    evas_object_show(split->panes);
 
@@ -1253,12 +1247,15 @@ _split_close(Term_Container *tc, Term_Container *child)
 {
    Split *split;
    Term_Container *parent, *other_child;
+   Evas_Object *top, *bottom;
 
    assert (tc->type == TERM_CONTAINER_TYPE_SPLIT);
    split = (Split*) tc;
 
-   elm_object_part_content_unset(split->panes, PANES_TOP);
-   elm_object_part_content_unset(split->panes, PANES_BOTTOM);
+   top = elm_object_part_content_unset(split->panes, PANES_TOP);
+   bottom = elm_object_part_content_unset(split->panes, PANES_BOTTOM);
+   evas_object_hide(top);
+   evas_object_hide(bottom);
 
    parent = tc->parent;
    other_child = (child == split->tc1) ? split->tc2 : split->tc1;
@@ -1360,11 +1357,13 @@ _split_split(Term_Container *tc, Term_Container *child,
 {
    Term *tm_new, *tm;
    Term_Container *tc_split, *tc_solo_new;
+   Split *split;
    Win *wn;
    Evas_Object *obj_split;
    char buf[PATH_MAX], *wdir = NULL;
 
    assert (tc->type == TERM_CONTAINER_TYPE_SPLIT);
+   split = (Split *)tc;
    wn = tc->wn;
 
    tm = child->focused_term_get(child);
@@ -1376,6 +1375,11 @@ _split_split(Term_Container *tc, Term_Container *child,
    tc_solo_new = _solo_new(tm_new, wn);
    evas_object_data_set(tm_new->termio, "sizedone", tm_new->termio);
 
+   if (child == split->tc1)
+        elm_object_part_content_unset(split->panes, PANES_TOP);
+   else
+        elm_object_part_content_unset(split->panes, PANES_BOTTOM);
+
    tc_split = _split_new(child, tc_solo_new, is_horizontal);
 
    obj_split = tc_split->get_evas_object(tc_split);
@@ -3639,6 +3643,8 @@ _term_free(Term *term)
    term->popmedia_deleted = EINA_FALSE;
    evas_object_del(term->termio);
    term->termio = NULL;
+
+   edje_object_part_unswallow(term->bg, term->base);
    evas_object_del(term->base);
    term->base = NULL;
    evas_object_del(term->bg);

-- 


Reply via email to