Important: Please read the Qt Code of Conduct -

Crash in QMediaPlayer.setPlayer() in debug mode

  • Hello,

    my application crashes under some circumstances when stopping media playback. I wanted to debug it and found out that I can not get to the point where it happens. If I start the application in debug mode, it crashes at this line:

    QString path = "C:/audiofile.mp3"
    QMediaPlayer player;
    player.setMedia(QUrl::fromLocalFile(path)); // here it crashes

    The crash only happens in debug mode. If I run the application normally, this works. Format of the file I try to play has no impact. But the next crash when stopping playback happens even in release mode. I do believe the second crash is also not in my code but somewhere in Qt libraries. But since I can not trigger it in debug mode I have no idea where and why it happens.

  • Sometimes it helps to rebuild all in Debug Mode.

  • Unfortunately this didn't help. Could someone please check if it is a common problem or if it happens only on my computer? Thank you.

  • Lifetime Qt Champion


    Then you should add the platform you are working on as well as compiler and Qt version.

  • I'm sorry I forgot to mention these important information. I tried Qt versions 5.9 and 5.9.1 with the same result. I'm testing it on Windows 7 with MinGW builds.

    I'll try it also on Linux when I get home.

    I'd like to mention that if I switch to QtAV as the playback engine, I don't get any crashes.

  • Lifetime Qt Champion

    QtAV uses ffmpeg as backend which is radically different from QtMultimedia who uses the native multimedia system.

  • @SGaist I know this, I just wanted to mention that the problem is very likely in QtMultimedia because with other playback engine it doesn't crash.

Log in to reply