summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Courtier-Dutton <jcdutton@users.sourceforge.net>2003-04-01 11:45:32 +0000
committerJames Courtier-Dutton <jcdutton@users.sourceforge.net>2003-04-01 11:45:32 +0000
commit7c3e2581194e0c09c2750a7d41f5ab416582cb29 (patch)
treeccf0f75bda3992cec16964df65802c368823cc5f
parent03354e69c37615084a4fbadc62a66243198c29f3 (diff)
downloadxine-lib-7c3e2581194e0c09c2750a7d41f5ab416582cb29.tar.gz
xine-lib-7c3e2581194e0c09c2750a7d41f5ab416582cb29.tar.bz2
Fix race condition, where spudec_reset is called and then a button update arrives from input_dvd.c before we have our this->menu_handle back.
CVS patchset: 4527 CVS date: 2003/04/01 11:45:32
-rw-r--r--src/input/input_dvd.c7
-rw-r--r--src/libspudec/xine_decoder.c15
-rw-r--r--src/xine-engine/video_overlay.c6
3 files changed, 21 insertions, 7 deletions
diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c
index f38dcbe04..84129957e 100644
--- a/src/input/input_dvd.c
+++ b/src/input/input_dvd.c
@@ -18,7 +18,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: input_dvd.c,v 1.138 2003/03/30 10:57:48 mroi Exp $
+ * $Id: input_dvd.c,v 1.139 2003/04/01 11:45:32 jcdutton Exp $
*
*/
@@ -84,7 +84,7 @@
#include "xine_internal.h"
/* Print debug messages? */
-/* #define INPUT_DEBUG */
+#define INPUT_DEBUG
/* Print trace messages? */
/* #define INPUT_DEBUG_TRACE */
@@ -1625,6 +1625,9 @@ static void *init_class (xine_t *xine, void *data) {
/*
* $Log: input_dvd.c,v $
+ * Revision 1.139 2003/04/01 11:45:32 jcdutton
+ * Fix race condition, where spudec_reset is called and then a button update arrives from input_dvd.c before we have our this->menu_handle back.
+ *
* Revision 1.138 2003/03/30 10:57:48 mroi
* additional sanity check on the part number
*
diff --git a/src/libspudec/xine_decoder.c b/src/libspudec/xine_decoder.c
index 034bde576..2fa5d9fb1 100644
--- a/src/libspudec/xine_decoder.c
+++ b/src/libspudec/xine_decoder.c
@@ -19,7 +19,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.94 2003/03/08 14:11:53 mroi Exp $
+ * $Id: xine_decoder.c,v 1.95 2003/04/01 11:45:33 jcdutton Exp $
*
* stuff needed to turn libspu into a xine decoder plugin
*/
@@ -171,13 +171,12 @@ static void spudec_dispose (spu_decoder_t *this_gen) {
spudec_decoder_t *this = (spudec_decoder_t *) this_gen;
int i;
video_overlay_instance_t *ovl_instance = this->stream->video_out->get_overlay_instance (this->stream->video_out);
-
+
if( this->menu_handle >= 0 )
ovl_instance->free_handle(ovl_instance,
this->menu_handle);
this->menu_handle = -1;
-
for (i=0; i < MAX_STREAMS; i++) {
if( this->spudec_stream_state[i].overlay_handle >= 0 )
ovl_instance->free_handle(ovl_instance,
@@ -223,9 +222,17 @@ static void spudec_set_button (spu_decoder_t *this_gen, int32_t button, int32_t
/* FIXME: Watch out for threads. We should really put a lock on this
* because events is a different thread than decode_data */
+ if( this->menu_handle < 0 ) {
+ if (this->stream->video_out) {
+ ovl_instance = this->stream->video_out->get_overlay_instance (this->stream->video_out);
+ this->menu_handle = ovl_instance->get_handle(ovl_instance,1);
+ }
+ }
#ifdef LOG_BUTTON
- printf ("libspudec:xine_decoder.c:spudec_event_listener:this->menu_handle=%u\n",this->menu_handle);
+ printf ("libspudec:xine_decoder.c:spudec_event_listener:this=%p\n",this);
+ printf ("libspudec:xine_decoder.c:spudec_event_listener:this->menu_handle=%d\n",this->menu_handle);
#endif
+ XINE_ASSERT(this->menu_handle >= 0, "Menu handle alloc failed. No more overlays objects available. Only 5 at once please.");
if (show > 0) {
#ifdef LOG_NAV
diff --git a/src/xine-engine/video_overlay.c b/src/xine-engine/video_overlay.c
index e1cf4fb7f..b049e6f3b 100644
--- a/src/xine-engine/video_overlay.c
+++ b/src/xine-engine/video_overlay.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: video_overlay.c,v 1.28 2003/03/23 15:01:45 mroi Exp $
+ * $Id: video_overlay.c,v 1.29 2003/04/01 11:45:33 jcdutton Exp $
*
*/
@@ -345,6 +345,10 @@ static int video_overlay_event( video_overlay_t *this, int64_t vpts ) {
vpts == 0) ) {
processed++;
handle=this->events[this_event].event->object.handle;
+#ifdef LOG_DEBUG
+ printf ("video_overlay: video_overlay_event: handle = %d\n", handle);
+ assert(handle >=0);
+#endif
switch( this->events[this_event].event->event_type ) {
case OVERLAY_EVENT_SHOW:
#ifdef LOG_DEBUG