fixed move_container bug, log prints before aborting

This commit is contained in:
taiyu 2015-08-26 16:27:01 -07:00
parent eb53f173c5
commit 274e56a602
2 changed files with 8 additions and 5 deletions

View file

@ -130,6 +130,7 @@ swayc_t *remove_child(swayc_t *child) {
parent->focused = NULL; parent->focused = NULL;
} }
} }
child->parent = NULL;
// deactivate view // deactivate view
if (child->type == C_VIEW) { if (child->type == C_VIEW) {
wlc_view_set_state(child->handle, WLC_BIT_ACTIVATED, false); wlc_view_set_state(child->handle, WLC_BIT_ACTIVATED, false);
@ -219,7 +220,7 @@ void move_container(swayc_t *container,swayc_t* root,enum movement_direction dir
} }
void move_container_to(swayc_t* container, swayc_t* destination) { void move_container_to(swayc_t* container, swayc_t* destination) {
if (container->parent == destination) { if (container == destination) {
return; return;
} }
swayc_t *parent = remove_child(container); swayc_t *parent = remove_child(container);
@ -236,8 +237,10 @@ void move_container_to(swayc_t* container, swayc_t* destination) {
} }
// Destroy old container if we need to // Destroy old container if we need to
parent = destroy_container(parent); parent = destroy_container(parent);
// Refocus
set_focused_container(get_focused_view(&root_container)); set_focused_container(get_focused_view(&root_container));
update_visibility(container); update_visibility(container);
update_visibility(parent);
arrange_windows(parent, -1, -1); arrange_windows(parent, -1, -1);
arrange_windows(destination->parent, -1, -1); arrange_windows(destination->parent, -1, -1);
} }

View file

@ -105,15 +105,15 @@ bool _sway_assert(bool condition, const char* format, ...) {
return true; return true;
} }
#ifndef NDEBUG
raise(SIGABRT);
#endif
va_list args; va_list args;
va_start(args, format); va_start(args, format);
sway_log(L_ERROR, format, args); sway_log(L_ERROR, format, args);
va_end(args); va_end(args);
#ifndef NDEBUG
raise(SIGABRT);
#endif
return false; return false;
} }