I am writing an application using a QDialog as the main Window. In this application I have 3 QGroupBox, one with several Buttons, the second one with a GLWidget displaying webcam content (captured and processed using OpenCV and displayed with OpenGL), and in the third one I was trying to play different videos using Phonon (basically I intend to select the videos using a QComboBox, although this is not relevant to my problem).
Everything works, the GUI initializes, does everything that I need... until I try to create a VideoWidget object. This is the code of my class:
GUIT::GUIT(QWidget *parent, Qt::WFlags flags)
{
// Initialization of the different QGroupBox
createVideo();
createButtons();
createScoreFE();
createPhonon();
gbScoreFE->hide();
QHBoxLayout *layout = new QHBoxLayout;
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(gbVideo, 0, 0);
mainLayout->addWidget(gbButtons, 1, 0);
mainLayout->addWidget(gbScoreFE, 0, 0);
layout->addLayout(mainLayout);
layout->addWidget(gbPhonon);
gbPhonon->hide();
this->setLayout(layout);
layout->setSizeConstraint(QLayout::SetFixedSize);
}
And the method that crashes is:
void GUIT::createPhonon()
{
gbPhonon = new QGroupBox(tr("Test"));
// This line makes the program to stop executing.
Phonon::VideoWidget *_player_video = new Phonon::VideoWidget;
QVBoxLayout *layout = new QVBoxLayout;
gbPhonon->setLayout(layout);
}
How does it crashes?? Well, it just kills several threads after creating a new VideoWidget. It just looks like:
The thread 'Win32 Thread' (0x12e8) has exited with code 1 (0x1).
The thread 'Win32 Thread' (0x1304) has exited with code 1 (0x1).
The thread 'Win32 Thread' (0xf20) has exited with code 1 (0x1).
The thread 'Win32 Thread' (0xdec) has exited with code 1 (0x1).
The thread 'QThread' (0x1e20) has exited with code 1 (0x1).
The thread 'Win32 Thread' (0x19b0) has exited with code 1 (0x1).
The thread 'Win32 Thread' (0x1f58) has exited with code 1 (0x1).
The thread 'Win32 Thread' (0x1794) has exited with code 1 (0x1).
The truth is that I'm a little bit confused about this problem. It arise while I was writing a QWidget where I was going to create the VideoWidget with its components... I checked other Phonon classes, and the GUI is not affected when they are initialized. Eg:
Phonon::MediaObject *mediaObject = new Phonon::MediaObject(this);
I have also tried to reproduce the problem with a simpler GUI, and it compiles and works with no problem, so there should be something that is in conflict with Phonon. I thought it could be the GLWidget, but I disconnected this part of the GUI... and it still kills the threads.
Has somebody run into a similar problem? Has somebody any insight of what could be going wrong or how to check the thread kills?
I think QDialog is the reason to cause that problem.