Important: Please read the Qt Code of Conduct -

Delete video player.

  • Hello developers.
    I' m finding problems to remove a video, when they was playing. I try stop the video using:
    @ ui->videoPlayer->stop();
    delete ui->videoPlayer;

    but, dont work. somebody can help me?

    (sorry for my english)

  • Moderators

    delete ui->videoPlayer;

    That is definitely not a good sequence. You are calling deleteLater() on something that is not there (or, to be more precise, on a dangling pointer). Deleting stuff from UI can also be tricky. You need to take layouts into consideration (be polite: remove widget from layout before deleting). However, I doubt that is what you need or want. You should stop the video, not remove the whole widget. If that is a widget, of course - it's hard to tell from that code.

Log in to reply