我遇到了非常奇怪的问题。我正在使用 VLCQt 库并成功运行了一个非常简单的视频播放器。但是当我想在主类中添加一个非常简单的 Qlabel 时,它会在此时崩溃ui->setupUi(this)。输出窗口包含以下语句:
HEAP[VideoPlayer.exe]:指定给 RtlValidateHeap(00000000002F0000, 0000000000334220) 的地址无效 VideoPlayer.exe 已触发断点。
简单播放器.h:
class SimplePlayer : public QMainWindow
{
Q_OBJECT
public:
SimplePlayer(QWidget *parent = 0);
~SimplePlayer();
private:
Ui::SimplePlayer *ui;
VlcInstance *_instance;
VlcMedia *_media;
VlcMediaPlayer *_player;
//QLabel *_lbl;// if I declare a very simple Qlabel the app crashes
private slots:
void openLocal();
void openUrl();
};
简单播放器.cpp
SimplePlayer::SimplePlayer(QWidget *parent)
: QMainWindow(parent)
{
ui->setupUi(this);
_instance = new VlcInstance(VlcCommon::args(), this);
_player = new VlcMediaPlayer(_instance);
_player->setVideoWidget(ui->video);
ui->video->setMediaPlayer(_player);
ui->volume->setMediaPlayer(_player);
ui->volume->setVolume(50);
ui->seek->setMediaPlayer(_player);
// _lbl = new QLabel;// if I declare a very simple Qlabel the app crashes
...//connections
}