[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-guile-ncurses] [PATCH] Do not destroy the panel when del_panel
From: |
Mike Gran |
Subject: |
Re: [Bug-guile-ncurses] [PATCH] Do not destroy the panel when del_panel is called. |
Date: |
Sat, 7 May 2016 17:21:10 +0000 (UTC) |
John
Thanks for all your hard work on this, but
what I think I'm going to do instead is use the fact that
a panel is really a subclass of a window, and merge the two
concepts into a single type.
Part of the reason this is so wonky is that panel is really
a decoration to the window class, and not its own class.
'new-panel' will be replaced with (make-panel! win) that'll
convert win into a panel, and then all the panel functions
can be used on that window.
It has the advantage of fixing the gc timing problems of
your first Hello/Goodbye example.
Sorry for changing an API.
> On Saturday, May 7, 2016 5:32 AM, John Darrington <address@hidden> wrote:
> > * 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, 2016/05/07
- Re: [Bug-guile-ncurses] [PATCH] Do not destroy the panel when del_panel is called.,
Mike Gran <=
- 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