summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
17ce364)
vlcInstance reference in MediaControl object (patch by Jan David Mol)
if( PyArg_ParseTuple( args, "O", &py_param ) )
{
if( PyArg_ParseTuple( args, "O", &py_param ) )
{
if( PyObject_TypeCheck( py_param, &vlcInstance_Type ) == 1 )
{
p_instance = ((vlcInstance*)py_param)->p_instance;
if( PyObject_TypeCheck( py_param, &vlcInstance_Type ) == 1 )
{
p_instance = ((vlcInstance*)py_param)->p_instance;
if( ! PySequence_Check( py_param ) )
{
PyErr_SetString( PyExc_TypeError, "Parameter must be a vlc.Instance or a sequence of strings." );
if( ! PySequence_Check( py_param ) )
{
PyErr_SetString( PyExc_TypeError, "Parameter must be a vlc.Instance or a sequence of strings." );
i_index ) ) ) );
}
ppsz_args[i_size] = NULL;
i_index ) ) ) );
}
ppsz_args[i_size] = NULL;
if( p_instance )
{
self->mc = mediacontrol_new_from_instance( p_instance, exception );
if( p_instance )
{
self->mc = mediacontrol_new_from_instance( p_instance, exception );
+ Py_INCREF( py_param );
+ self->vlc_instance = py_param;
}
else
{
self->mc = mediacontrol_new( i_size, ppsz_args, exception );
}
else
{
self->mc = mediacontrol_new( i_size, ppsz_args, exception );
+ self->vlc_instance = PyObject_New( vlcInstance, &vlcInstance_Type );
+ self->vlc_instance->p_instance = mediacontrol_get_libvlc_instance( SELF->mc );
}
MC_EXCEPT;
Py_END_ALLOW_THREADS
}
MC_EXCEPT;
Py_END_ALLOW_THREADS
static void
MediaControl_dealloc( PyObject *self )
{
static void
MediaControl_dealloc( PyObject *self )
{
+ Py_DECREF( SELF->vlc_instance );
+ PyObject_DEL( self );
- p_ret = PyObject_New( vlcInstance, &vlcInstance_Type );
- if( !p_ret )
- return NULL;
- p_ret->p_instance = mediacontrol_get_libvlc_instance( SELF->mc );
+ p_ret = SELF->vlc_instance;
+ Py_INCREF( p_ret );
return ( PyObject * )p_ret;
}
return ( PyObject * )p_ret;
}