diff options
author | Christian Vogler <cvogler@users.sourceforge.net> | 2002-04-27 23:00:38 +0000 |
---|---|---|
committer | Christian Vogler <cvogler@users.sourceforge.net> | 2002-04-27 23:00:38 +0000 |
commit | 4a6395e90d6bb701e8c41dd4b9f7ef0709e1d0b0 (patch) | |
tree | 0c6135ff76558c3632b8c229881235511e5e2621 | |
parent | 351c466a6753a03162f67356d554940f39a4187a (diff) | |
download | xine-lib-4a6395e90d6bb701e8c41dd4b9f7ef0709e1d0b0.tar.gz xine-lib-4a6395e90d6bb701e8c41dd4b9f7ef0709e1d0b0.tar.bz2 |
Add function to unregister configfile callback.
Necessary to prevent segfaults if target of a callback has been disposed.
CVS patchset: 1788
CVS date: 2002/04/27 23:00:38
-rw-r--r-- | include/xine.h.tmpl.in | 8 | ||||
-rw-r--r-- | src/libspucc/xine_decoder.c | 14 | ||||
-rw-r--r-- | src/xine-engine/configfile.c | 25 | ||||
-rw-r--r-- | src/xine-engine/configfile.h | 13 |
4 files changed, 55 insertions, 5 deletions
diff --git a/include/xine.h.tmpl.in b/include/xine.h.tmpl.in index f0e6f35cc..fa61f7fa2 100644 --- a/include/xine.h.tmpl.in +++ b/include/xine.h.tmpl.in @@ -28,7 +28,7 @@ \endverbatim */ /* - * $Id: xine.h.tmpl.in,v 1.91 2002/04/09 04:35:17 miguelfreitas Exp $ + * $Id: xine.h.tmpl.in,v 1.92 2002/04/27 23:00:38 cvogler Exp $ * */ @@ -678,6 +678,12 @@ struct config_values_s { */ void (*dispose) (config_values_t *self); + /* + * unregister callback function + */ + void (*unregister_callback) (config_values_t *this, + char *key); + /* * config values are stored here: */ diff --git a/src/libspucc/xine_decoder.c b/src/libspucc/xine_decoder.c index a0623dcb4..bcfe5ad74 100644 --- a/src/libspucc/xine_decoder.c +++ b/src/libspucc/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.9 2002/04/23 15:45:24 esnel Exp $ + * $Id: xine_decoder.c,v 1.10 2002/04/27 23:00:40 cvogler Exp $ * * closed caption spu decoder. receive data by events. * @@ -253,6 +253,16 @@ static void spucc_register_cfg_vars(spucc_decoder_t *this, } +static void spucc_unregister_cfg_callbacks(config_values_t *xine_cfg) { + xine_cfg->unregister_callback(xine_cfg, "misc.cc_enabled"); + xine_cfg->unregister_callback(xine_cfg, "misc.cc_scheme"); + xine_cfg->unregister_callback(xine_cfg, "misc.cc_font"); + xine_cfg->unregister_callback(xine_cfg, "misc.cc_italic_font"); + xine_cfg->unregister_callback(xine_cfg, "misc.cc_font_size"); + xine_cfg->unregister_callback(xine_cfg, "misc.cc_center"); +} + + /* called when the video frame size changes */ void spucc_notify_frame_change(spucc_decoder_t *this, int width, int height) { @@ -366,7 +376,7 @@ static void spudec_dispose (spu_decoder_t *this_gen) { spucc_decoder_t *this = (spucc_decoder_t *) this_gen; xine_remove_event_listener (this->xine, spudec_event_listener); - + spucc_unregister_cfg_callbacks(this->xine->config); pthread_mutex_destroy (&this->cc_mutex); free (this); } diff --git a/src/xine-engine/configfile.c b/src/xine-engine/configfile.c index e5e754387..a238c8dda 100644 --- a/src/xine-engine/configfile.c +++ b/src/xine-engine/configfile.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: configfile.c,v 1.20 2002/04/11 07:17:43 esnel Exp $ + * $Id: configfile.c,v 1.21 2002/04/27 23:00:40 cvogler Exp $ * * config file management - implementation * @@ -611,6 +611,23 @@ static void config_file_dispose (config_values_t *this) free (this); } + +static void config_file_unregister_cb (config_values_t *this, + char *key) +{ + cfg_entry_t *entry; + + assert (this); + assert (key); + + entry = config_file_lookup_entry (this, key); + if (entry) { + entry->callback = NULL; + entry->callback_data = NULL; + } +} + + config_values_t *xine_config_file_init (char *filename) { #ifdef HAVE_IRIXAL @@ -642,6 +659,7 @@ config_values_t *xine_config_file_init (char *filename) { this->save = config_file_save; this->read = config_file_read; this->dispose = config_file_dispose; + this->unregister_callback = config_file_unregister_cb; return this; } @@ -649,6 +667,11 @@ config_values_t *xine_config_file_init (char *filename) { /* * $Log: configfile.c,v $ + * Revision 1.21 2002/04/27 23:00:40 cvogler + * Add function to unregister configfile callback. + * + * Necessary to prevent segfaults if target of a callback has been disposed. + * * Revision 1.20 2002/04/11 07:17:43 esnel * Fix configfile corruption reported by Chris Rankin * diff --git a/src/xine-engine/configfile.h b/src/xine-engine/configfile.h index 22d5a35e8..5f3608129 100644 --- a/src/xine-engine/configfile.h +++ b/src/xine-engine/configfile.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: configfile.h,v 1.9 2002/03/16 13:33:47 esnel Exp $ + * $Id: configfile.h,v 1.10 2002/04/27 23:00:40 cvogler Exp $ * * config file management * @@ -173,6 +173,12 @@ struct config_values_s { */ void (*dispose) (config_values_t *this); + /* + * unregister callback function + */ + void (*unregister_callback) (config_values_t *this, + char *key); + /* * config values are stored here: */ @@ -193,6 +199,11 @@ config_values_t *xine_config_file_init (char *filename); /* * $Log: configfile.h,v $ + * Revision 1.10 2002/04/27 23:00:40 cvogler + * Add function to unregister configfile callback. + * + * Necessary to prevent segfaults if target of a callback has been disposed. + * * Revision 1.9 2002/03/16 13:33:47 esnel * fix memory leak, add dispose() function to config_values_s * |