[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-guile-ncurses] [PATCH] Do not destroy the panel when del_panel is c
From: |
John Darrington |
Subject: |
[Bug-guile-ncurses] [PATCH] Do not destroy the panel when del_panel is called. |
Date: |
Sat, 7 May 2016 14:31:53 +0200 |
* ncurses/panel_type.c (gucu_del_panel): Remove call to gc_free_panel and
instead
simply call the del_panel curses function and set gc->panel to NULL.
(gc_free_panel): Do not del_panel if gc->panel is NULL;
---
ncurses/panel_type.c | 35 +++++++++++++++++++++++++++--------
1 file changed, 27 insertions(+), 8 deletions(-)
diff --git a/ncurses/panel_type.c b/ncurses/panel_type.c
index b475a11..dda42a7 100644
--- a/ncurses/panel_type.c
+++ b/ncurses/panel_type.c
@@ -143,7 +143,6 @@ size_t
gc_free_panel (SCM x)
{
struct gucu_panel *gp;
- int retval;
scm_assert_smob_type (panel_tag, x);
@@ -151,13 +150,16 @@ gc_free_panel (SCM x)
assert (gp != NULL);
- retval = del_panel (gp->panel);
- if (retval != OK)
+ if (gp->panel)
{
- 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);
+ int retval = del_panel (gp->panel);
+ if (retval != OK)
+ {
+ 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);
+ }
}
/* Release scheme objects from the guardians */
@@ -173,7 +175,24 @@ SCM
gucu_del_panel (SCM x)
{
SCM_ASSERT (_scm_is_panel (x), x, SCM_ARG1, "del-panel");
- gc_free_panel (x);
+
+ struct gucu_panel *gp = (struct gucu_panel *) SCM_SMOB_DATA (x);
+
+ assert (gp != NULL);
+
+ if (gp->panel)
+ {
+ int retval = del_panel (gp->panel);
+ if (retval != OK)
+ {
+ scm_error_scm (SCM_BOOL_F,
+ scm_from_locale_string ("deletion of panel"),
+ scm_from_locale_string ("bad argument"),
+ SCM_BOOL_F, SCM_BOOL_F);
+ }
+ gp->panel = NULL;
+ }
+
return SCM_UNSPECIFIED;
}
--
2.1.4
- [Bug-guile-ncurses] Crash in simple program., John Darrington, 2016/05/06
- Re: [Bug-guile-ncurses] Crash in simple program., Mike Gran, 2016/05/06
- Re: [Bug-guile-ncurses] Crash in simple program., John Darrington, 2016/05/07
- [Bug-guile-ncurses] [PATCH] Do not destroy the panel when del_panel is called.,
John Darrington <=
- Re: [Bug-guile-ncurses] [PATCH] Do not destroy the panel when del_panel is called., Mike Gran, 2016/05/07
- Re: [Bug-guile-ncurses] [PATCH] Do not destroy the panel when del_panel is called., John Darrington, 2016/05/07
- Re: [Bug-guile-ncurses] [PATCH] Do not destroy the panel when del_panel is called., Mike Gran, 2016/05/07
- Re: [Bug-guile-ncurses] [PATCH] Do not destroy the panel when del_panel is called., John Darrington, 2016/05/08