summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Gran <spk121@yahoo.com>2016-05-06 06:56:09 -0700
committerMichael Gran <spk121@yahoo.com>2016-05-06 06:56:09 -0700
commitc2732a854dc8823099787bd40bebf8339ded0df6 (patch)
treedae29b7347c146a610eac0d5a1cb97ceaf3ac17c
parenta39aa86e2dd812df2435307a9d1ea2e55accbe72 (diff)
downloadguile-ncurses-c2732a854dc8823099787bd40bebf8339ded0df6.tar.gz
Avoid SEGV cause by GC marking a deleted panel
If a panel has been hard deleted (instead of just GC'd) using del-panel its internals are null. * ncurses/panel_type.c (mark_panel): don't mark NULL panel
-rw-r--r--ncurses/panel_type.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/ncurses/panel_type.c b/ncurses/panel_type.c
index 4296124..48bc9f6 100644
--- a/ncurses/panel_type.c
+++ b/ncurses/panel_type.c
@@ -128,9 +128,13 @@ mark_panel (SCM x)
gp = (struct gucu_panel *) SCM_SMOB_DATA (x);
- scm_gc_mark (gp->window);
+ if (gp != NULL)
+ {
+ scm_gc_mark (gp->window);
+ scm_gc_mark (gp->win_guard);
+ }
- return gp->win_guard;
+ return NULL;
}
/* The curses primitive that frees memory is called del_panel. Note
@@ -150,7 +154,7 @@ gc_free_panel (SCM x)
retval = del_panel (gp->panel);
if (retval != OK)
{
- scm_error_scm (scm_from_locale_symbol ("ncurses"),
+ scm_error_scm (SCM_BOOL_F,
scm_from_locale_string ("garbage collection of panel"),
scm_from_locale_string ("bad argument"),
SCM_BOOL_F, SCM_BOOL_F);