forked from enlightenment/enlightenment
fix crash after moving gadget between two zones
Summary: add check new_gcc into the gadman's gadget add handler to prevent invalid ref_count increase while moving between two zones. and also add object clean code for new_gcc and drag_gcc when gadget is dropped. Fixes T722 Test Plan: 1. create clock module on gadcon desktop (settings->gadgets, select "background" under layers, click "configure layer" and add a clock gadget). 2. drag clock gadget from one screen to the other. drop it there. 3. drag clock back to first screen 4. right click on clock and select "clock->remove". Reviewers: raster, devilhorns, zmike Subscribers: cedric Maniphest Tasks: T722 Differential Revision: https://phab.enlightenment.org/D1256
This commit is contained in:
parent
d5cbe23bd2
commit
ec8a6b829e
|
@ -3081,8 +3081,7 @@ _e_gadcon_cb_dnd_drop(void *data, const char *type __UNUSED__, void *event __UNU
|
||||||
if (gc->dnd_drop_cb) gc->dnd_drop_cb(gc, gc->drag_gcc);
|
if (gc->dnd_drop_cb) gc->dnd_drop_cb(gc, gc->drag_gcc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* still has refcount from drag */
|
|
||||||
e_object_del(E_OBJECT(gc->drag_gcc));
|
|
||||||
gcc = gc->new_gcc;
|
gcc = gc->new_gcc;
|
||||||
|
|
||||||
if (!gc->o_container)
|
if (!gc->o_container)
|
||||||
|
@ -3099,12 +3098,17 @@ _e_gadcon_cb_dnd_drop(void *data, const char *type __UNUSED__, void *event __UNU
|
||||||
e_gadcon_custom_populate_request(gc);
|
e_gadcon_custom_populate_request(gc);
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
if (gc->dnd_drop_cb) gc->dnd_drop_cb(gc, gc->drag_gcc);
|
if (gc->dnd_drop_cb) gc->dnd_drop_cb(gc, gc->drag_gcc);
|
||||||
return;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (gc->editing) e_gadcon_client_edit_begin(gc->new_gcc);
|
if (gc->editing) e_gadcon_client_edit_begin(gc->new_gcc);
|
||||||
gc->new_gcc = NULL;
|
gc->new_gcc = NULL;
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
if (gc->dnd_drop_cb) gc->dnd_drop_cb(gc, gc->drag_gcc);
|
if (gc->dnd_drop_cb) gc->dnd_drop_cb(gc, gc->drag_gcc);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
/* still has refcount from drag */
|
||||||
|
e_object_del(E_OBJECT(gc->drag_gcc));
|
||||||
|
gc->drag_gcc = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -220,6 +220,8 @@ gadman_gadget_add_handler(void *d __UNUSED__, int type __UNUSED__, E_Event_Gadco
|
||||||
if (!l) return ECORE_CALLBACK_RENEW;
|
if (!l) return ECORE_CALLBACK_RENEW;
|
||||||
if (ev->gcc->cf->geom.pos_x || ev->gcc->cf->geom.pos_y || ev->gcc->cf->geom.size_w || ev->gcc->cf->geom.size_h)
|
if (ev->gcc->cf->geom.pos_x || ev->gcc->cf->geom.pos_y || ev->gcc->cf->geom.size_w || ev->gcc->cf->geom.size_h)
|
||||||
return ECORE_CALLBACK_RENEW;
|
return ECORE_CALLBACK_RENEW;
|
||||||
|
if ((ev->gcc->gadcon->new_gcc) && (ev->gcc->gadcon->new_gcc == ev->gcc))
|
||||||
|
return ECORE_CALLBACK_RENEW;
|
||||||
ev->gcc->cf->style = eina_stringshare_add(ev->gcc->client_class->default_style ?: E_GADCON_CLIENT_STYLE_INSET);
|
ev->gcc->cf->style = eina_stringshare_add(ev->gcc->client_class->default_style ?: E_GADCON_CLIENT_STYLE_INSET);
|
||||||
ev->gcc->style = eina_stringshare_ref(ev->gcc->cf->style);
|
ev->gcc->style = eina_stringshare_ref(ev->gcc->cf->style);
|
||||||
ev->gcc->cf->geom.pos_x = DEFAULT_POS_X;
|
ev->gcc->cf->geom.pos_x = DEFAULT_POS_X;
|
||||||
|
|
Loading…
Reference in New Issue