Fix use-after free introduced by cbe7364

This commit is contained in:
Drew DeVault 2017-10-09 12:03:32 -04:00
parent 6271abd644
commit ec73c19121

View file

@ -516,10 +516,10 @@ swayc_t *destroy_view(swayc_t *view) {
return NULL; return NULL;
} }
sway_log(L_DEBUG, "Destroying view '%p'", view); sway_log(L_DEBUG, "Destroying view '%p'", view);
swayc_t *parent = view->parent;
free_swayc(view); free_swayc(view);
// Destroy empty containers // Destroy empty containers
swayc_t *parent = view->parent;
if (parent && parent->type == C_CONTAINER) { if (parent && parent->type == C_CONTAINER) {
return destroy_container(parent); return destroy_container(parent);
} }