Commit effab3c5 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Fixed gtk core-dump on exit. Used code from gtk plugin for this.

parent 8d9c1ec6
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* familiar.c : familiar plugin for vlc * familiar.c : familiar plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: familiar.c,v 1.3 2002/07/22 20:52:42 jpsaman Exp $ * $Id: familiar.c,v 1.4 2002/07/22 21:04:55 jpsaman Exp $
* *
* Authors: Jean-Paul Saman <jpsaman@wxs.nl> * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* *
...@@ -39,6 +39,54 @@ ...@@ -39,6 +39,54 @@
#include "familiar_support.h" #include "familiar_support.h"
#include "familiar.h" #include "familiar.h"
/*****************************************************************************
* Local variables (mutex-protected).
*****************************************************************************/
static void ** pp_global_data = NULL;
/*****************************************************************************
* g_atexit: kludge to avoid the Gtk+ thread to segfault at exit
*****************************************************************************
* gtk_init() makes several calls to g_atexit() which calls atexit() to
* register tidying callbacks to be called at program exit. Since the Gtk+
* plugin is likely to be unloaded at program exit, we have to export this
* symbol to intercept the g_atexit() calls. Talk about crude hack.
*****************************************************************************/
void g_atexit( GVoidFunc func )
{
intf_thread_t *p_intf;
int i_dummy;
if( pp_global_data == NULL )
{
atexit( func );
return;
}
p_intf = (intf_thread_t *)*pp_global_data;
if( p_intf == NULL )
{
return;
}
for( i_dummy = 0;
i_dummy < MAX_ATEXIT && p_intf->p_sys->pf_callback[i_dummy] != NULL;
i_dummy++ )
{
;
}
if( i_dummy >= MAX_ATEXIT - 1 )
{
msg_Err( p_intf, "too many atexit() callbacks to register" );
return;
}
p_intf->p_sys->pf_callback[i_dummy] = func;
p_intf->p_sys->pf_callback[i_dummy + 1] = NULL;
}
/***************************************************************************** /*****************************************************************************
* Local prototypes. * Local prototypes.
*****************************************************************************/ *****************************************************************************/
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* familiar.h: private Gtk+ interface description * familiar.h: private Gtk+ interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: familiar.h,v 1.2 2002/07/22 19:49:40 jpsaman Exp $ * $Id: familiar.h,v 1.3 2002/07/22 21:04:55 jpsaman Exp $
* *
* Authors: Jean-Paul Saman <jpsaman@wxs.nl> * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* *
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
#define MAX_ATEXIT 10
/***************************************************************************** /*****************************************************************************
* intf_sys_t: description and status of Gtk+ interface * intf_sys_t: description and status of Gtk+ interface
*****************************************************************************/ *****************************************************************************/
...@@ -31,5 +33,8 @@ struct intf_sys_t ...@@ -31,5 +33,8 @@ struct intf_sys_t
/* The input thread */ /* The input thread */
input_thread_t * p_input; input_thread_t * p_input;
/* XXX: Ugly kludge, see gtk.c */
void ( *pf_callback[MAX_ATEXIT] ) ( void );
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment