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

Christian Gallant christian at masterkitchen.de
Thu Mar 18 10:30:57 CET 2010


Hi Hugo,

thanks for the answer. (Reply to your first mail)

> 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

Ok I guess u mean QCustomEvent. But that is not supposed to be the problem. The error occurs even with use of
SIGNAL and SLOTS or directly calling the method. And it was the wrong description from my side as I use customEvent() with QEvent.
E.g. -> static const QEvent::Type VideoComplete = (QEvent::Type)1234;
-> Fire with: QApplication::postEvent(me, new QEvent(VLCPlayer::VideoComplete));
-> And override: virtual void customEvent(QEvent* event);


> > 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

Not tos et the player to NULL will not help.

>
> >        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.

Ok. So I gotta search again.


Regards
Chris





More information about the vlc-devel mailing list