PDA

View Full Version : Unhandled exception at 0x01f71318 in Editor.exe: 0xC0000096: Privileged instruction"



ricardo
3rd May 2009, 12:36
Hi friends!

My program works perfectly in Debug mode. But if I choose Realeas mode, when I close my program I receive this nice window from Visual Studio 2005 (I use Qt4.5 open source):
"Unhandled exception at 0x01f71318 in Editor.exe: 0xC0000096: Privileged instruction."
Break or Continue.

However, if I execute it outside IDE, everything works fine.

I have no idea what is going on, I tried commenting all my signals/slots but no result.

Any idea?
Thanks a lot.

aamer4yu
3rd May 2009, 12:40
When such problems occur in release and not in debug,,, first thing is to check if all your variables are properly initialized...

ricardo
3rd May 2009, 16:03
When such problems occur in release and not in debug,,, first thing is to check if all your variables are properly initialized...

Some variables were not initialized, but after fixing it, I still have the same problem.

However, I realised I get this message when I lauch the app:
QPainter::begin: Paint device returned engine == 0, type: 1
QPainter::setPen: Painter not active

Any idea?
Thanks a lot

ricardo
3rd May 2009, 16:22
Forget it. Now works fine, I don't know why. (maybe initialization and I forgot to rebuild)

Anyway, any idea about this:
"QPainter::begin: Paint device returned engine == 0, type: 1
QPainter::setPen: Painter not active"

Thanks.

aamer4yu
3rd May 2009, 17:47
Can you trace that to which line in your code it points to ?
Do u get this message even after initialzing the variables ?

ricardo
3rd May 2009, 18:11
Can you trace that to which line in your code it points to ?
Do u get this message even after initialzing the variables ?

Thanks for reply. I only have this problem in release mode, so I'm cannot trace it, that's the problem :(

faldzip
4th May 2009, 00:24
You can paste some qDebugs in your code (for example at the first lines of each suspected method with Q_FUNC_INFO, __FILE__ and __LINE__):


qDebug() << Q_FUNC_INFO; // prints full method name
qDebug() << "file:" << __FILE__ << " line:" << __LINE__; // prints file and line where this code is
then you can maybe find when those QPainter warnings are printed.

ricardo
4th May 2009, 01:38
You can paste some qDebugs in your code (for example at the first lines of each suspected method with Q_FUNC_INFO, __FILE__ and __LINE__):


qDebug() << Q_FUNC_INFO; // prints full method name
qDebug() << "file:" << __FILE__ << " line:" << __LINE__; // prints file and line where this code is
then you can maybe find when those QPainter warnings are printed.

I didn't know that. Very interesting.
Q_FUNC_INFO works, but not __FILE__ and __LINE__

Do last 3 macros belong to Qt or VS compiler?

Thanks.

faldzip
4th May 2009, 08:25
I used __FILE__ and __LINE__ with gcc on Linux, but I thought it's rather common and should work on VS for example.
And there is also Qt Meta Object system whick can give you some info. Every class which has a moc part (so inherits QObject and has a Q_OBJECT macro) has a metaObject() which returns QMetaObject, which has methods like classInfo(), className() - can be also useful :]

ricardo
4th May 2009, 11:09
Interesting. I'll use it, thanks.

markoczy
25th April 2015, 01:13
Ran into the same error, it seems to be quite Random (at least in my case). The Error occured in debug mode, running the program in release mode, then again in debug mode fixed it.. Hope this helps to anyone. (Might be a bug...)