Qt-interest Archive, May 2008
Random crashes from simple Qt app
Message 1 in thread
Hi all,
I'm experiencing random crashes with my simple Qt app.
The app was very straightforward, just a QApplication running
a QMainWindow, with nothing in it save for some menus
that werent connected to any slots.
I buid my app on Qt/Windows with Qt 4.3.4 built from source.
The debug build was fine. No crashes occurring when I run the
resulting executable linked against Qtxxxxd4.lib.
But when I linked against the release version (Qtxxxx4.lib) and
run the resulting executable, I got random crashes. Sometimes
it occurs when I repeatedly resize the window, some other time when I
do some action on the menus.
Anyone have any clue on what's going on, or how to trace the cause
will be very much appreciated.
Regards.
--
[ signature omitted ]
Message 2 in thread
This is hard to diagnose without seeing some code.
>The debug build was fine. No crashes occurring when I run the resulting executable
The lack of crashes in debug mode doesn't mean the code is OK, obviously -- it could be a timing issue, or something else.
Do the Qt demos work OK?
Sam Dutton
SAM DUTTON
SENIOR SITE DEVELOPER
200 GRAY'S INN ROAD
LONDON
WC1X 8XZ
UNITED KINGDOM
T +44 (0)20 7430 4496
F
E Sam.Dutton@xxxxxxxxx
WWW.ITN.CO.UK
P Please consider the environment. Do you really need to print this email?
-----Original Message-----
From: Barkah Yusuf Widodo [mailto:barkah.yusuf@xxxxxxxxx]
Sent: Thursday 22 May 2008 15:44
To: qt-interest@xxxxxxxxxxxxx
Subject: Random crashes from simple Qt app
Hi all,
I'm experiencing random crashes with my simple Qt app.
The app was very straightforward, just a QApplication running a QMainWindow, with nothing in it save for some menus that werent connected to any slots.
I buid my app on Qt/Windows with Qt 4.3.4 built from source.
The debug build was fine. No crashes occurring when I run the resulting executable linked against Qtxxxxd4.lib.
But when I linked against the release version (Qtxxxx4.lib) and run the resulting executable, I got random crashes. Sometimes it occurs when I repeatedly resize the window, some other time when I do some action on the menus.
Anyone have any clue on what's going on, or how to trace the cause will be very much appreciated.
Regards.
--
[ signature omitted ]
Message 3 in thread
On Thu, May 22, 2008 at 11:27 PM, Dutton, Sam <Sam.Dutton@xxxxxxxxx> wrote:
> The lack of crashes in debug mode doesn't mean the code is OK, obviously -- it could be a timing issue, or something else.
Thanks for the reply...
Since I didn't do any fancy stuff in my app, I'm pretty sure the code
is OK. Just to show how straightforward my crashing program are,
I did only the following:
- Created a class AppWindow inherited from QMainWindow.
- in AppWindow ctor, I set the basic geometries and create some empty QActions
by empty, I mean they'r not connected to any slots.
- Added the actions to menubar using menuBar::addMenu()
- Created a main func and a QApplication, and run the whole thing.
> Do the Qt demos work OK?
Haven't tried them but I will.
Another info that I think should be noticed. I'm using VC++ for development.
For debug mode, I didn't set the "SubSystem" option (/SUBSYSTEM switch)
For release mode, I use /SUBSYSTEM:WINDOWS switch to turn off the
popping console window when the executable runs.
However, the code still laden with qDebug() lines (my so far futile effort to
trace the cause). Might this (printing to console without the console
being there)
be the cause of the crashes?
I come from java background where of course, if there's errors , stack
trace can
always be obtained no matter if the code is built for debug or release. In C++
programming and with Qt in particular I'm somewhat new. Is there any way to
trace an executable's execution without debugging info embedded? (excluding the
qDebug() or std::cout alternatives). Say, using profiler or some sort?
I tried the VC++
debugger, but since debugging info has been stripped down from the
release exec,
it doesn't help.
--
[ signature omitted ]
Message 4 in thread
> Von: "Barkah Yusuf Widodo"
> Another info that I think should be noticed. I'm using VC++ for
> development.
> For debug mode, I didn't set the "SubSystem" option (/SUBSYSTEM switch)
> For release mode, I use /SUBSYSTEM:WINDOWS switch to turn off the
> popping console window when the executable runs.
>
This points me to another thing. Are you sure that you compile against release Qt dlls when creating your release executable? You can't mix debug and release libs (the /M(T|d)d switches have to be the same).
Christian
--
[ signature omitted ]
Message 5 in thread
Hi Barkah
Please reply to the list, not my email address -- thanks.
>I did only the following:
You'll really need to post actual code -- what you describe below is what you *want* to happen :-).
>However, the code still laden with qDebug() lines... Might this ... be the cause of the crashes?
Could be. Take them out or put them in #ifdef _DEBUG sections.
Sam
From: Barkah Yusuf Widodo
Sent: Fri 5/23/2008 01:24
To: Dutton, Sam
Subject: Re: Random crashes from simple Qt app
On Thu, May 22, 2008 at 11:27 PM, Dutton, Sam <Sam.Dutton@xxxxxxxxx> wrote:
> The lack of crashes in debug mode doesn't mean the code is OK, obviously -- it could be a timing issue, or something else.
Thanks for the reply...
Since I didn't do any fancy stuff in my app, I'm pretty sure the code
is OK. Just to show how straightforward my crashing program are,
I did only the following:
- Created a class AppWindow inherited from QMainWindow.
- in AppWindow ctor, I set the basic geometries and create some empty QActions
by empty, I mean they'r not connected to any slots.
- Added the actions to menubar using menuBar::addMenu()
- Created a main func and a QApplication, and run the whole thing.
> Do the Qt demos work OK?
Haven't tried them but I will.
Another info that I think should be noticed. I'm using VC++ for development.
For debug mode, I didn't set the "SubSystem" option (/SUBSYSTEM switch)
For release mode, I use /SUBSYSTEM:WINDOWS switch to turn off the
popping console window when the executable runs.
However, the code still laden with qDebug() lines (my so far futile effort to
trace the cause). Might this (printing to console without the console
being there)
be the cause of the crashes?
I come from java background where of course, if there's errors , stack
trace can
always be obtained no matter if the code is built for debug or release. In C++
programming and with Qt in particular I'm somewhat new. Is there any way to
trace an executable's execution without debugging info embedded? (excluding the
qDebug() or std::cout alternatives). Say, using profiler or some sort?
I tried the VC++
debugger, but since debugging info has been stripped down from the
release exec,
it doesn't help.
--
[ signature omitted ]
Message 6 in thread
>>However, the code still laden with qDebug() lines... Might this ... be the cause of the crashes?
> Could be. Take them out or put them in #ifdef _DEBUG sections.
define QT_NO_DEBUG_OUTPUT
--
[ signature omitted ]