PDA

View Full Version : Getting error on release mode



m_brott
24th March 2011, 08:08
Hello,

I derived a class from QGLWidget, after i add this widget in my application it works well in debug mode if i change to release mode i'm getting this error ;
http://img202.imageshack.us/img202/9960/59785133.th.png (http://img202.imageshack.us/i/59785133.png/)
Click for see Image

Do you have any idea about that ?

Ps Qt Version 4.7 i have booth debug and release libraries ..

MarekR22
24th March 2011, 08:17
Do you use some assertions? If yes then probably you are using it wrong!
I don't see another explanation since erros says that QApplication was not created.
How you main function looks like?

m_brott
24th March 2011, 08:26
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
a.setStyle(new QCleanlooksStyle);
QPixmap pix(":/Images/Splash.png");
SplashScreen Splash(pix,305, 22);
Splash.setMask(pix.mask());
Splash.setWindowOpacity(0);
Splash.show();
for (int i=0; i<100; ++i ) {
Sleep(10);
Splash.setWindowOpacity(i*0.01);
Splash.setMessage(QString("Test : ").append(QString().setNum(i+1)));
}
Initialization(&Splash);

MainWindow w;
w.show();
Splash.finish(&w);

return a.exec();
}

MainWindow, on this step ;

MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
.
.
.
}

ui_mainwindow.h :

glArea = new GLWidget(frmOperation);



i'm getting error on this step : glArea = new GLWidget(frmOperation);

but it works well in debug mode ...

stampede
24th March 2011, 08:30
Show the code of GLWidget constructor. Have you tried to make a clean release build (make clean, qmake, make release) ?

m_brott
24th March 2011, 08:53
GLWidget::GLWidget (QWidget *parent) : QGLWidget(parent) {
}

There is no code in ctor. I tried clean and rebuikd again and again still getting same error :s

stampede
24th March 2011, 09:05
Are you including some additional libraries in release mode ? Can we see .pro file ?

m_brott
24th March 2011, 09:30
I'm using Visual Studio , i double checked compile, linker options it is look like fine. I made simple application just using my GLWidget it works on release and debug, i'm gonna checking project settings again ..

Added after 14 minutes:

in QWidget.cpp :

if (!qApp) {
qFatal("QWidget: Must construct a QApplication before a QPaintDevice");
return;
}

static QCoreApplication *instance() { return self; }

qApp (self) is gets NULL in release mode but it gets valid value in debug mode

m_brott
24th March 2011, 13:04
guys, i stuck with this, is there any idea ?

stampede
24th March 2011, 13:16
I made simple application just using my GLWidget it works on release and debug, i'm gonna checking project settings again ..
You got it working already, right ?

m_brott
24th March 2011, 13:56
Yay it works atm. Thanks for help ...