PDA

View Full Version : Qt OpenGL: Assertion Failed When Close the Window



Seishin
13th August 2012, 15:40
Hi,

I'm writing a graphics program in Qt with OpenGL. When I try to close the program, there is a debug error says:


Program: [directory of my program]
Module: 4.7.2
File: global\qglobal.cpp
Line: 2262

ASSERT: "group->context() == q_ptr" in file .\qgl.cpp, line 1657

This error even occurs when I just close the example program (chap20\tetrahedron) of book "C++ GUI Programming with Qt 4, Second Edition".
I'm using VS 2010 on Win 7 64bit, could anyone help me on this? Thanks.

Alex.Konnen
15th August 2012, 14:54
Hi,
I am experiencing exactly the same thing. Also VS 2010 with Windows 7, 64 Bit, Qt 2.8.2.
Would be nice if someone would provide a hint.

TIA,
Alex

Seishin
15th August 2012, 20:00
Found the line causes the error:

setFormat(QGLFormat(QGL::DoubleBuffer | QGL::DepthBuffer));
Any thought of this?

Alex.Konnen
16th August 2012, 08:30
Thank you, Seishin. It works. Now it would be interesting to learn why. :)

Phys1k3r
21st August 2012, 14:42
Hello,
I've got the problem.

This code crashes:


OpenGlViewer::OpenGlViewer(QWidget *parent): QGLWidget(parent)
{
this->setFormat(QGLFormat(QGL::SampleBuffers));
}


When I change the code to the following, it doesn't crash anymore:


OpenGlViewer::OpenGlViewer(QWidget *parent): QGLWidget(QGLFormat(QGL::SampleBuffers),parent)
{
}


Like you guys I'd like to know the reason of this.
Thank you for your time.

Seishin
21st August 2012, 15:18
Hello,
I've got the problem.

This code crashes:


OpenGlViewer::OpenGlViewer(QWidget *parent): QGLWidget(parent)
{
this->setFormat(QGLFormat(QGL::SampleBuffers));
}


When I change the code to the following, it doesn't crash anymore:


OpenGlViewer::OpenGlViewer(QWidget *parent): QGLWidget(QGLFormat(QGL::SampleBuffers),parent)
{
}


Like you guys I'd like to know the reason of this.
Thank you for your time.

Yes that's how I solved it. But still not know the reason.