Commit 7303aa6c authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Do not release NULL instances

parent eedf8fda
......@@ -167,13 +167,14 @@ Instance::Instance(Internal::InternalPtr ptr)
void Instance::release()
{
if ( m_obj )
if ( isValid() )
libvlc_release(m_obj);
}
void Instance::retain()
{
libvlc_retain(m_obj);
if ( isValid() )
libvlc_retain(m_obj);
}
} // namespace VLC
......
......@@ -210,12 +210,14 @@ Media::Media(Internal::InternalPtr ptr)
void Media::retain()
{
libvlc_media_retain(m_obj);
if ( isValid() )
libvlc_media_retain(m_obj);
}
void Media::release()
{
libvlc_media_release(m_obj);
if ( isValid() )
libvlc_media_release(m_obj);
}
} // namespace VLC
......
......@@ -65,15 +65,16 @@ bool MediaDiscoverer::isRunning()
return libvlc_media_discoverer_is_running(m_obj);
}
MediaDiscoverer::MediaDiscoverer(Internal::InternalPtr ptr)
MediaDiscoverer::MediaDiscoverer( Internal::InternalPtr ptr )
: Internal( ptr )
, m_eventManager( NULL )
{
assert( ptr != NULL );
}
void MediaDiscoverer::release()
{
libvlc_media_discoverer_release(m_obj);
libvlc_media_discoverer_release( m_obj );
}
} // namespace VLC
......
......@@ -656,7 +656,8 @@ MediaPlayer::MediaPlayer( InternalPtr ptr )
void MediaPlayer::retain()
{
libvlc_media_player_retain( m_obj );
if ( isValid() )
libvlc_media_player_retain( m_obj );
}
std::vector<TrackDescription> MediaPlayer::getTracksDescription(libvlc_track_description_t* tracks) const
......@@ -676,7 +677,8 @@ std::vector<TrackDescription> MediaPlayer::getTracksDescription(libvlc_track_des
void MediaPlayer::release()
{
libvlc_media_player_release(m_obj);
if ( isValid() )
libvlc_media_player_release( m_obj );
}
} // namespace VLC
......
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