Changeset 28ad2fd075be37cb4258af5806896ab042897c09
- Timestamp:
- 21/08/02 19:31:58
(6 years ago)
- Author:
- Sam Hocevar <sam@videolan.org>
- git-committer:
- Sam Hocevar <sam@videolan.org> 1029951118 +0000
- git-parent:
[a5a565cb0b6d5b361d680928446b7a3c3dd0b26a]
- git-author:
- Sam Hocevar <sam@videolan.org> 1029951118 +0000
- Message:
- ./src/misc/modules.c: if a plugin requested not to be unloaded, then we
won't unload it. This makes us more fault-tolerant with crap libraries
that are making use of atexit().
- ./configure.in: svgalib can now be a plugin.
- ./modules/misc/gtk_main.c: gtk_main doesn't need g_atexit anymore.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rb6aeeca |
r28ad2fd |
|
| 8154 | 8154 | if test "x${enable_svgalib}" = "xyes" |
|---|
| 8155 | 8155 | then |
|---|
| 8156 | | BUILTINS="${BUILTINS} video_output/svgalib" |
|---|
| | 8156 | PLUGINS="${PLUGINS} video_output/svgalib" |
|---|
| 8157 | 8157 | svgalib_LDFLAGS="${svgalib_LDFLAGS} -lvgagl -lvga" |
|---|
| 8158 | 8158 | fi |
|---|
| rb6aeeca |
r28ad2fd |
|
| 1436 | 1436 | if test "x${enable_svgalib}" = "xyes" |
|---|
| 1437 | 1437 | then |
|---|
| 1438 | | BUILTINS="${BUILTINS} video_output/svgalib" |
|---|
| | 1438 | PLUGINS="${PLUGINS} video_output/svgalib" |
|---|
| 1439 | 1439 | svgalib_LDFLAGS="${svgalib_LDFLAGS} -lvgagl -lvga" |
|---|
| 1440 | 1440 | fi |
|---|
| r5dc2da7 |
r28ad2fd |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2001 VideoLAN |
|---|
| 5 | | * $Id: modules.h,v 1.60 2002/08/15 12:11:15 sam Exp $ |
|---|
| | 5 | * $Id: modules.h,v 1.61 2002/08/21 17:31:58 sam Exp $ |
|---|
| 6 | 6 | * |
|---|
| 7 | 7 | * Authors: Samuel Hocevar <sam@zoy.org> |
|---|
| … | … | |
| 72 | 72 | u32 i_cpu; /* Required CPU capabilities */ |
|---|
| 73 | 73 | |
|---|
| | 74 | vlc_bool_t b_unloadable; /* Can we be dlclosed? */ |
|---|
| | 75 | vlc_bool_t b_reentrant; /* Are we reentrant? */ |
|---|
| 74 | 76 | vlc_bool_t b_submodule; /* Is this a submodule? */ |
|---|
| 75 | 77 | |
|---|
| r005be13 |
r28ad2fd |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2001 VideoLAN |
|---|
| 5 | | * $Id: modules_inner.h,v 1.30 2002/08/14 17:06:53 sam Exp $ |
|---|
| | 5 | * $Id: modules_inner.h,v 1.31 2002/08/21 17:31:58 sam Exp $ |
|---|
| 6 | 6 | * |
|---|
| 7 | 7 | * Authors: Samuel Hocevar <sam@zoy.org> |
|---|
| … | … | |
| 88 | 88 | STORE_SYMBOLS; \ |
|---|
| 89 | 89 | p_module->b_submodule = VLC_FALSE; \ |
|---|
| | 90 | p_module->b_unloadable = VLC_TRUE; \ |
|---|
| | 91 | p_module->b_reentrant = VLC_TRUE; \ |
|---|
| 90 | 92 | p_module->psz_object_name = MODULE_STRING; \ |
|---|
| 91 | 93 | p_module->psz_longname = MODULE_STRING; \ |
|---|
| … | … | |
| 146 | 148 | |
|---|
| 147 | 149 | #define set_description( desc ) \ |
|---|
| 148 | | p_module->psz_longname = desc |
|---|
| | 150 | p_submodule->psz_longname = desc |
|---|
| 149 | 151 | |
|---|
| 150 | 152 | #define set_capability( cap, score ) \ |
|---|
| … | … | |
| 158 | 160 | p_submodule->pf_activate = activate; \ |
|---|
| 159 | 161 | p_submodule->pf_deactivate = deactivate |
|---|
| | 162 | |
|---|
| | 163 | #define linked_with_a_crap_library_which_uses_atexit( ) \ |
|---|
| | 164 | p_module->b_unloadable = VLC_FALSE |
|---|
| 160 | 165 | |
|---|
| 161 | 166 | /* |
|---|
| ra5a565c |
r28ad2fd |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2002 VideoLAN |
|---|
| 5 | | * $Id: gtk_main.c,v 1.3 2002/08/21 15:55:15 sam Exp $ |
|---|
| | 5 | * $Id: gtk_main.c,v 1.4 2002/08/21 17:31:58 sam Exp $ |
|---|
| 6 | 6 | * |
|---|
| 7 | 7 | * Authors: Samuel Hocevar <sam@zoy.org> |
|---|
| … | … | |
| 52 | 52 | VLC_COMMON_MEMBERS |
|---|
| 53 | 53 | |
|---|
| 54 | | /* XXX: Ugly kludge, see g_atexit */ |
|---|
| 55 | | void ( *pf_callback[MAX_ATEXIT] ) ( void ); |
|---|
| 56 | | |
|---|
| 57 | 54 | } gtk_main_t; |
|---|
| 58 | 55 | |
|---|
| … | … | |
| 60 | 57 | * Local variables (mutex-protected). |
|---|
| 61 | 58 | *****************************************************************************/ |
|---|
| 62 | | static void ** pp_global_data = NULL; |
|---|
| 63 | 59 | static int i_refcount = 0; |
|---|
| 64 | 60 | static gtk_main_t * p_gtk_main = NULL; |
|---|
| … | … | |
| 68 | 64 | *****************************************************************************/ |
|---|
| 69 | 65 | vlc_module_begin(); |
|---|
| 70 | | pp_global_data = p_module->p_vlc->pp_global_data; |
|---|
| 71 | 66 | set_description( _("Gtk+ helper module") ); |
|---|
| 72 | 67 | set_capability( "gtk_main", 100 ); |
|---|
| … | … | |
| 76 | 71 | #endif |
|---|
| 77 | 72 | set_callbacks( Open, Close ); |
|---|
| | 73 | linked_with_a_crap_library_which_uses_atexit(); |
|---|
| 78 | 74 | vlc_module_end(); |
|---|
| 79 | | |
|---|
| 80 | | /***************************************************************************** |
|---|
| 81 | | * g_atexit: kludge to avoid the Gtk+ thread to segfault at exit |
|---|
| 82 | | ***************************************************************************** |
|---|
| 83 | | * gtk_init() makes several calls to g_atexit() which calls atexit() to |
|---|
| 84 | | * register tidying callbacks to be called at program exit. Since the Gtk+ |
|---|
| 85 | | * plugin is likely to be unloaded at program exit, we have to export this |
|---|
| 86 | | * symbol to intercept the g_atexit() calls. Talk about crude hack. |
|---|
| 87 | | *****************************************************************************/ |
|---|
| 88 | | void g_atexit( GVoidFunc func ) |
|---|
| 89 | | { |
|---|
| 90 | | gtk_main_t *p_this; |
|---|
| 91 | | |
|---|
| 92 | | int i_dummy; |
|---|
| 93 | | |
|---|
| 94 | | if( pp_global_data == NULL ) |
|---|
| 95 | | { |
|---|
| 96 | | atexit( func ); |
|---|
| 97 | | return; |
|---|
| 98 | | } |
|---|
| 99 | | |
|---|
| 100 | | p_this = (gtk_main_t *)*pp_global_data; |
|---|
| 101 | | if( p_this == NULL ) |
|---|
| 102 | | { |
|---|
| 103 | | /* Looks like this atexit() call wasn't for us. */ |
|---|
| 104 | | return; |
|---|
| 105 | | } |
|---|
| 106 | | |
|---|
| 107 | | for( i_dummy = 0; |
|---|
| 108 | | i_dummy < MAX_ATEXIT && p_this->pf_callback[i_dummy] != NULL; |
|---|
| 109 | | i_dummy++ ) |
|---|
| 110 | | { |
|---|
| 111 | | ; |
|---|
| 112 | | } |
|---|
| 113 | | |
|---|
| 114 | | if( i_dummy >= MAX_ATEXIT - 1 ) |
|---|
| 115 | | { |
|---|
| 116 | | msg_Err( p_this, "too many atexit() callbacks to register" ); |
|---|
| 117 | | return; |
|---|
| 118 | | } |
|---|
| 119 | | |
|---|
| 120 | | p_this->pf_callback[i_dummy] = func; |
|---|
| 121 | | p_this->pf_callback[i_dummy + 1] = NULL; |
|---|
| 122 | | } |
|---|
| 123 | 75 | |
|---|
| 124 | 76 | /***************************************************************************** |
|---|
| … | … | |
| 127 | 79 | static int Open( vlc_object_t *p_this ) |
|---|
| 128 | 80 | { |
|---|
| 129 | | /* Initialize Gtk+ */ |
|---|
| 130 | | |
|---|
| 131 | 81 | vlc_mutex_lock( p_this->p_vlc->p_global_lock ); |
|---|
| 132 | 82 | |
|---|
| … | … | |
| 140 | 90 | |
|---|
| 141 | 91 | p_gtk_main = vlc_object_create( p_this, sizeof(gtk_main_t) ); |
|---|
| 142 | | p_gtk_main->pf_callback[0] = NULL; |
|---|
| 143 | 92 | |
|---|
| 144 | 93 | /* Only initialize gthreads if it's the first time we do it */ |
|---|
| … | … | |
| 169 | 118 | static void Close( vlc_object_t *p_this ) |
|---|
| 170 | 119 | { |
|---|
| 171 | | int i_dummy; |
|---|
| 172 | | |
|---|
| 173 | 120 | vlc_mutex_lock( p_this->p_vlc->p_global_lock ); |
|---|
| 174 | 121 | |
|---|
| … | … | |
| 183 | 130 | gtk_main_quit(); |
|---|
| 184 | 131 | vlc_thread_join( p_gtk_main ); |
|---|
| 185 | | |
|---|
| 186 | | /* Launch stored callbacks */ |
|---|
| 187 | | for( i_dummy = 0; |
|---|
| 188 | | i_dummy < MAX_ATEXIT && p_gtk_main->pf_callback[i_dummy] != NULL; |
|---|
| 189 | | i_dummy++ ) |
|---|
| 190 | | { |
|---|
| 191 | | p_gtk_main->pf_callback[i_dummy](); |
|---|
| 192 | | } |
|---|
| 193 | 132 | |
|---|
| 194 | 133 | vlc_object_destroy( p_gtk_main ); |
|---|
| … | … | |
| 219 | 158 | static int i_args = 1; |
|---|
| 220 | 159 | |
|---|
| 221 | | /* gtk_init will register stuff with g_atexit, so we need to have |
|---|
| 222 | | * the global lock if we want to be able to intercept the calls */ |
|---|
| 223 | | *p_this->p_vlc->pp_global_data = p_gtk_main; |
|---|
| 224 | | |
|---|
| 225 | 160 | /* FIXME: deprecated ? */ |
|---|
| 226 | 161 | /* gdk_threads_init(); */ |
|---|
| rb6aeeca |
r28ad2fd |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2002 VideoLAN |
|---|
| 5 | | * $Id: svgalib.c,v 1.1 2002/08/21 15:10:33 sam Exp $ |
|---|
| | 5 | * $Id: svgalib.c,v 1.2 2002/08/21 17:31:58 sam Exp $ |
|---|
| 6 | 6 | * |
|---|
| 7 | 7 | * Authors: Samuel Hocevar <sam@zoy.org> |
|---|
| … | … | |
| 54 | 54 | set_capability( "video output", 0 ); |
|---|
| 55 | 55 | set_callbacks( Create, Destroy ); |
|---|
| | 56 | linked_with_a_crap_library_which_uses_atexit(); |
|---|
| 56 | 57 | vlc_module_end(); |
|---|
| 57 | 58 | |
|---|
| r18773d0 |
r28ad2fd |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2001 VideoLAN |
|---|
| 5 | | * $Id: modules.c,v 1.91 2002/08/21 11:07:42 xav Exp $ |
|---|
| | 5 | * $Id: modules.c,v 1.92 2002/08/21 17:31:58 sam Exp $ |
|---|
| 6 | 6 | * |
|---|
| 7 | 7 | * Authors: Samuel Hocevar <sam@zoy.org> |
|---|
| … | … | |
| 824 | 824 | if( !p_module->b_builtin ) |
|---|
| 825 | 825 | { |
|---|
| 826 | | module_unload( p_module->handle ); |
|---|
| | 826 | if( p_module->b_unloadable ) |
|---|
| | 827 | { |
|---|
| | 828 | module_unload( p_module->handle ); |
|---|
| | 829 | } |
|---|
| 827 | 830 | UndupModule( p_module ); |
|---|
| 828 | 831 | free( p_module->psz_filename ); |
|---|