Commit 8b8b4f54 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Ugly hack to prevent crash when logging an error while destroying libvlc

parent 0d0f59ac
...@@ -358,16 +358,22 @@ void __vlc_object_destroy( vlc_object_t *p_this ) ...@@ -358,16 +358,22 @@ void __vlc_object_destroy( vlc_object_t *p_this )
vlc_object_internals_t *p_priv = vlc_internals( p_this ); vlc_object_internals_t *p_priv = vlc_internals( p_this );
int i_delay = 0; int i_delay = 0;
/* FIXME: ugly hack - we cannot use the message queue after
* msg_Destroy(). */
vlc_object_t *logger = p_this;
if( p_this->p_libvlc == p_this )
logger = NULL;
if( p_this->i_children ) if( p_this->i_children )
{ {
msg_Err( p_this, "cannot delete object (%i, %s) with children" , msg_Err( logger, "cannot delete object (%i, %s) with children" ,
p_this->i_object_id, p_this->psz_object_name ); p_this->i_object_id, p_this->psz_object_name );
return; return;
} }
if( p_this->p_parent ) if( p_this->p_parent )
{ {
msg_Err( p_this, "cannot delete object (%i, %s) with a parent", msg_Err( logger, "cannot delete object (%i, %s) with a parent",
p_this->i_object_id, p_this->psz_object_name ); p_this->i_object_id, p_this->psz_object_name );
return; return;
} }
...@@ -379,21 +385,21 @@ void __vlc_object_destroy( vlc_object_t *p_this ) ...@@ -379,21 +385,21 @@ void __vlc_object_destroy( vlc_object_t *p_this )
/* Don't warn immediately ... 100ms seems OK */ /* Don't warn immediately ... 100ms seems OK */
if( i_delay == 2 ) if( i_delay == 2 )
{ {
msg_Warn( p_this, msg_Warn( logger,
"refcount is %u, delaying before deletion (id=%d,type=%d)", "refcount is %u, delaying before deletion (id=%d,type=%d)",
p_priv->i_refcount, p_this->i_object_id, p_priv->i_refcount, p_this->i_object_id,
p_this->i_object_type ); p_this->i_object_type );
} }
else if( i_delay == 10 ) else if( i_delay == 10 )
{ {
msg_Err( p_this, msg_Err( logger,
"refcount is %u, delaying again (id=%d,type=%d)", "refcount is %u, delaying again (id=%d,type=%d)",
p_priv->i_refcount, p_this->i_object_id, p_priv->i_refcount, p_this->i_object_id,
p_this->i_object_type ); p_this->i_object_type );
} }
else if( i_delay == 20 ) else if( i_delay == 20 )
{ {
msg_Err( p_this, msg_Err( logger,
"waited too long, cancelling destruction (id=%d,type=%d)", "waited too long, cancelling destruction (id=%d,type=%d)",
p_this->i_object_id, p_this->i_object_type ); p_this->i_object_id, p_this->i_object_type );
return; return;
......
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