Fix an event leak

Original commit message from CVS:
Fix an event leak
Ne need to save signals on longjmp
This commit is contained in:
Wim Taymans 2001-12-23 14:50:44 +00:00
parent bdd6df925e
commit 6c538d527b
4 changed files with 10 additions and 5 deletions

View file

@ -233,8 +233,10 @@ cothread_destroy (cothread_state *thread)
GST_INFO (GST_CAT_COTHREADS, "destroy cothread %d %p %d", threadnum, thread, ctx->current); GST_INFO (GST_CAT_COTHREADS, "destroy cothread %d %p %d", threadnum, thread, ctx->current);
/* we have to unlock here because we might be switched out with the lock held */
cothread_unlock (thread);
#ifndef COTHREAD_ATOMIC #ifndef COTHREAD_ATOMIC
g_mutex_unlock (thread->lock);
g_mutex_free (thread->lock); g_mutex_free (thread->lock);
#endif #endif
@ -429,7 +431,7 @@ cothread_switch (cothread_state * thread)
#ifdef GST_ARCH_PRESETJMP #ifdef GST_ARCH_PRESETJMP
GST_ARCH_PRESETJMP (); GST_ARCH_PRESETJMP ();
#endif #endif
enter = sigsetjmp (current->jmp, 1); enter = setjmp (current->jmp);
if (enter != 0) { if (enter != 0) {
GST_DEBUG (0, "enter thread #%d %d %p<->%p (%d)\n", current->threadnum, enter, GST_DEBUG (0, "enter thread #%d %d %p<->%p (%d)\n", current->threadnum, enter,
current->sp, current->top_sp, (char*)current->top_sp - (char*)current->sp); current->sp, current->top_sp, (char*)current->top_sp - (char*)current->sp);
@ -447,7 +449,7 @@ cothread_switch (cothread_state * thread)
if (thread->flags & COTHREAD_STARTED) { if (thread->flags & COTHREAD_STARTED) {
GST_DEBUG (0, "in thread \n"); GST_DEBUG (0, "in thread \n");
/* switch to it */ /* switch to it */
siglongjmp (thread->jmp, 1); longjmp (thread->jmp, 1);
} }
else { else {
GST_ARCH_SETUP_STACK ((char*)thread->sp); GST_ARCH_SETUP_STACK ((char*)thread->sp);

View file

@ -54,7 +54,7 @@ struct _cothread_state {
int flags; int flags;
void *sp; void *sp;
sigjmp_buf jmp; jmp_buf jmp;
/* is this needed any more? */ /* is this needed any more? */
void *top_sp; void *top_sp;
void *pc; void *pc;

View file

@ -92,6 +92,8 @@ gst_event_new (GstEventType type)
void void
gst_event_free (GstEvent* event) gst_event_free (GstEvent* event)
{ {
GST_INFO (GST_CAT_EVENT, "freeing event %p", event);
g_mutex_lock (_gst_event_chunk_lock); g_mutex_lock (_gst_event_chunk_lock);
if (GST_EVENT_SRC (event)) { if (GST_EVENT_SRC (event)) {
gst_object_unref (GST_EVENT_SRC (event)); gst_object_unref (GST_EVENT_SRC (event));

View file

@ -2017,14 +2017,15 @@ gst_pad_event_default (GstPad *pad, GstEvent *event)
pads = g_list_next (pads); pads = g_list_next (pads);
} }
} }
gst_event_free (event);
/* we have to try to schedule another element because this one is deisabled */ /* we have to try to schedule another element because this one is deisabled */
gst_element_yield (element); gst_element_yield (element);
break; break;
default: default:
g_warning ("no default handler for event\n"); g_warning ("no default handler for event\n");
gst_event_free (event);
break; break;
} }
gst_event_free (event);
} }
/** /**