1
0
mirror of git://projects.qi-hardware.com/fped.git synced 2024-11-22 07:23:08 +02:00

reset reachable_pkg in the instantiation process and restore on inst_revert

Before, it was reset outside and not restored when instatiation failed.
This caused fped to segfault.
This commit is contained in:
Werner Almesberger 2012-05-28 23:58:05 -03:00
parent 5d76af2d7c
commit 59b90b3054
2 changed files with 4 additions and 2 deletions

1
gui.c
View File

@ -328,7 +328,6 @@ void change_world(void)
status_begin_reporting();
before = inst_get_bbox();
reachable_is_active = reachable_pkg && reachable_pkg == active_pkg;
reachable_pkg = NULL;
instantiate();
if (reachable_is_active && reachable_pkg &&
reachable_pkg != active_pkg) {

5
inst.c
View File

@ -38,7 +38,7 @@ struct pkg *pkgs, *active_pkg, *curr_pkg;
struct pkg *reachable_pkg = NULL;
struct inst *frame_instantiating = NULL;
static struct pkg *prev_pkgs;
static struct pkg *prev_pkgs, *prev_reachable_pkg;
static unsigned long active_set = 0;
@ -1248,7 +1248,9 @@ void inst_start(void)
active_frame_bbox = bbox_zero;
prev_pkgs = pkgs;
prev_reachable_pkg = reachable_pkg;
pkgs = NULL;
reachable_pkg = NULL;
inst_select_pkg(NULL, 0);
curr_pkg = pkgs;
frame_instantiating = NULL;
@ -1274,6 +1276,7 @@ void inst_revert(void)
{
free_pkgs(pkgs);
pkgs = prev_pkgs;
reachable_pkg = prev_reachable_pkg;
}