[vlc-devel] MediaPlayer crash or deadlock (only) if mouse moves over video after libvlc_MediaPlayerEndReached

Hugo Beauzee-Luyssen beauze.h at gmail.com
Thu Mar 18 10:07:28 CET 2010


On Thu, Mar 18, 2010 at 9:06 AM, Christian Gallant
<christian at masterkitchen.de> wrote:
> Hi,
>

Hi,

> we discovered a strange error at the end of our movies playing in a QT-Framework with libvlc (1.0.3 or 1.0.5).
>
> After the libvlc_MediaPlayerEndReached comes to the callback, we do something with the movie (reset, go back to main menu, or loop...). The libvlc_media_player seems to be deleted after the event so we delete the holder-widget as well an create a new one.
>
> It has to be said, that I don´t call the methods directly  from the callback, but instead (as I read here) use a QCustomEvent which is fired with postEvent() at this point.
> ( Couldn´t find the libvlc_event_attach_async so it did it with QT)
>

This class has been deprecated with Qt, i'd recommand you use SLOT and
SIGNAL instead

> So far everything works fine with one exception. If the user moves the mouse (cursor) over the video the app hangs at the destructor of our VLCPlayer Widget. This will not happen if we move the mouse over the VideoController- Widget or move the main Window...
>
> Here Some code to see where it will hang. I commented the locations where the app will crash.
>
> // Desctructor
> VLCPlayer::~VLCPlayer()
> {
>        /* Stop playing if the user pressed the close button.
>
>        libvlc_media_player_stop(_mp, &_vlcexcep);
>        vlcraise (&_vlcexcep);
>
>        NOTE: 1. It will crash here if the mouse was moved over the video.

If you don't call you dtor from the callback directly, I don't really
see what could cause this. Could you provide some kind of backtrace ?

>
>        ...
>        libvlc_event_detach(em_mp, libvlc_MediaPlayerEndReached, callbacks, this, &_vlcexcep);
>        ...
>
>
>        if (_mp) {
>                libvlc_media_player_release(_mp);
>                _mp = NULL;
>        }
>        vlcraise (&_vlcexcep);
>
>        NOTE: 2. It will crash here as well if the mouse was moved over the video.
>

That seems logical seems you need the media player for anything
related to the playback, and you just set it to NULL

>        if (_m) {
>                libvlc_media_release(_m);
>                _m = NULL;
>        }
>
>        vlcraise (&_vlcexcep);
>        qDebug("~VLCPlayer released _m");
>
>      libvlc_release(_vlcinstance);
>        qDebug("~VLCPlayer released _vlcinstance");
>
>    vlcraise (&_vlcexcep);
> }
>
>
> Once again: Everything works fine if we don´t move the cursor over the video. To have the cursor over it without moving is no problem.
>
>
> Thanks for some hints.
>
> Regards
> Chris

We don't have any problem in vlmc, though we also use Qt and libvlc,
so I don't think this crash is directly related to VLC itself.

Regards,

-- 
Hugo Beauzée-Luyssen



More information about the vlc-devel mailing list