Skip to content

Commit 8d3f262

Browse files
committed
Remove a tiling when its last frame is removed
Instead of incorrectly 'recovering', which lead to a tiling that no longer worked and eventually caused crashes.
1 parent 7a90854 commit 8d3f262

File tree

4 files changed

+6
-51
lines changed

4 files changed

+6
-51
lines changed

ioncore/frame.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ bool frame_init(WFrame *frame, WWindow *parent, const WFitParams *fp,
6464
WFrameMode mode, char *name)
6565
{
6666
WRectangle mg;
67-
fprintf(stderr, "creating frame at %x\n", frame);
6867

6968
frame->flags=0;
7069
frame->saved_geom.w=0;

libtu/obj.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ void destroy_obj(Obj *obj)
2929
{
3030
ClassDescr *d;
3131

32-
fprintf(stderr, "Destroying object of type %s at %x\n", OBJ_TYPESTR(obj), obj);
33-
3432
if(OBJ_IS_BEING_DESTROYED(obj))
3533
return;
3634

@@ -149,7 +147,6 @@ DynFun *lookup_dynfun(const Obj *obj, DynFun *func,
149147

150148
descr=obj->obj_type;
151149

152-
//fprintf(stderr, "lookup_dynfun for obj %s at %x, obj_type at %x\n", OBJ_TYPESTR(obj), obj, obj->obj_type);
153150
for(; descr!=&Obj_classdescr; descr=descr->ancestor){
154151
if(descr->funtab==NULL)
155152
continue;

mod_tiling/split.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ bool splitinner_init(WSplitInner *split, const WRectangle *geom)
191191

192192
bool splitsplit_init(WSplitSplit *split, const WRectangle *geom, int dir)
193193
{
194-
fprintf(stderr, "creating wsplitsplit at %x\n", split);
195194
splitinner_init(&(split->isplit), geom);
196195
split->dir=dir;
197196
split->tl=NULL;
@@ -275,7 +274,6 @@ void splitsplit_deinit(WSplitSplit *split)
275274
void splitregion_deinit(WSplitRegion *split)
276275
{
277276
if(split->reg!=NULL){
278-
fprintf(stderr, "deinitting splitregion at %x with reg %s %x\n", split, OBJ_TYPESTR(split->reg), split->reg);
279277
set_node_of_reg(split->reg, NULL);
280278
split->reg=NULL;
281279
}
@@ -1865,7 +1863,6 @@ void splitinner_mark_current(WSplitInner *split, WSplit *child)
18651863

18661864
static void splitsplit_forall(WSplitSplit *node, WSplitFn *fn)
18671865
{
1868-
fprintf(stderr, "executing fn for both children of the WSplitSplit at %x: %s %x -> %s %x & %s %x\n", node, OBJ_TYPESTR(node->isplit.split.parent), node->isplit.split.parent, OBJ_TYPESTR(node->tl), node->tl, OBJ_TYPESTR(node->br), node->br);
18691866
fn(node->tl);
18701867
fn(node->br);
18711868
}
@@ -1996,10 +1993,8 @@ void split_map(WSplit *split)
19961993

19971994
static void splitregion_unmap(WSplitRegion *split)
19981995
{
1999-
if(split->reg!=NULL) {
2000-
fprintf(stderr, "unmapping splitregion at %x with reg %s %x\n", split, OBJ_TYPESTR(split->reg), split->reg);
1996+
if(split->reg!=NULL)
20011997
region_unmap(split->reg);
2002-
}
20031998
}
20041999

20052000
static void splitinner_unmap(WSplitInner *split)

mod_tiling/tiling.c

Lines changed: 5 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,6 @@ bool tiling_managed_add(WTiling *ws, WRegion *reg)
515515
bool tiling_do_attach_initial(WTiling *ws, WRegion *reg)
516516
{
517517
assert(ws->split_tree==NULL);
518-
fprintf(stderr, "tiling_do_attach_initial\n");
519518

520519
ws->split_tree=(WSplit*)create_splitregion(&REGION_GEOM(reg), reg);
521520
if(ws->split_tree==NULL)
@@ -543,7 +542,6 @@ bool tiling_init(WTiling *ws, WWindow *parent, const WFitParams *fp,
543542
WRegionSimpleCreateFn *create_frame_fn, bool ci)
544543
{
545544
const char *p[1];
546-
fprintf(stderr, "tiling_init\n");
547545

548546
ws->split_tree=NULL;
549547
ws->create_frame_fn=(create_frame_fn
@@ -594,7 +592,6 @@ bool tiling_init(WTiling *ws, WWindow *parent, const WFitParams *fp,
594592

595593
region_register(&(ws->reg));
596594
region_add_bindmap((WRegion*)ws, mod_tiling_tiling_bindmap);
597-
fprintf(stderr, "tiling_initted\n");
598595

599596
return TRUE;
600597
}
@@ -702,34 +699,12 @@ void tiling_managed_remove(WTiling *ws, WRegion *reg)
702699
if(node==(WSplitRegion*)(ws->stdispnode))
703700
ws->stdispnode=NULL;
704701

705-
if(node!=NULL){
706-
bool reused=FALSE;
702+
if(node!=NULL)
703+
splittree_remove((WSplit*)node, (!norestore && other!=NULL));
707704

708-
if(other==NULL && !norestore){
709-
WWindow *par=REGION_PARENT(ws);
710-
WFitParams fp;
711-
712-
assert(par!=NULL);
713-
714-
fp.g=node->split.geom;
715-
fp.mode=REGION_FIT_EXACT;
716-
717-
other=(ws->create_frame_fn)(par, &fp);
718-
719-
if(other!=NULL){
720-
node->reg=other;
721-
tiling_managed_add(ws, other);
722-
reused=TRUE;
723-
}else{
724-
warn(TR("Tiling in useless state."));
725-
}
726-
}
727-
728-
if(!reused)
729-
splittree_remove((WSplit*)node, (!norestore && other!=NULL));
730-
}
731-
732-
if(!norestore && other!=NULL && act && mcf)
705+
if(other==NULL)
706+
destroy_obj((Obj*)ws);
707+
else if(!norestore && act && mcf)
733708
region_warp(other);
734709
}
735710

@@ -1082,20 +1057,13 @@ void do_unsplit(WRegion *reg)
10821057
if(ws==NULL)
10831058
return;
10841059

1085-
fprintf(stderr, "unsplitting %s at %x\n", OBJ_TYPESTR(reg), reg);
1086-
10871060
ph=region_get_rescue_pholder_for((WRegion*)ws, reg);
10881061

10891062
if(ph==NULL){
1090-
fprintf(stderr, "no rescue needed?\n");
10911063
res=!region_rescue_needed(reg);
1092-
fprintf(stderr, "res %d\n", res);
10931064
}else{
1094-
fprintf(stderr, "rescueing\n");
10951065
res=region_rescue(reg, ph);
1096-
fprintf(stderr, "rescued, destroying ph\n");
10971066
destroy_obj((Obj*)ph);
1098-
fprintf(stderr, "destroyed ph\n");
10991067
}
11001068

11011069
if(!res){
@@ -1104,9 +1072,7 @@ void do_unsplit(WRegion *reg)
11041072
return;
11051073
}
11061074

1107-
fprintf(stderr, "destroying %x\n", reg);
11081075
destroy_obj((Obj*)reg);
1109-
fprintf(stderr, "end do_unsplit\n");
11101076
}
11111077

11121078

@@ -1679,7 +1645,6 @@ WRegion *tiling_load(WWindow *par, const WFitParams *fp, ExtlTab tab)
16791645
ws->split_tree=tiling_load_node(ws, &REGION_GEOM(ws), treetab);
16801646
extl_unref_table(treetab);
16811647
}
1682-
fprintf(stderr, "loaded node\n");
16831648

16841649
if(ws->split_tree==NULL){
16851650
warn(TR("The workspace is empty."));
@@ -1690,7 +1655,6 @@ WRegion *tiling_load(WWindow *par, const WFitParams *fp, ExtlTab tab)
16901655
ws->split_tree->ws_if_root=ws;
16911656
split_restack(ws->split_tree, ws->dummywin, Above);
16921657

1693-
fprintf(stderr, "restacked\n");
16941658
return (WRegion*)ws;
16951659
}
16961660

0 commit comments

Comments
 (0)