Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, December 2006
MSVC 6.0 SP6 crashes on QApplication app(argc, argv);


Message 1 in thread

Hi There,

I have a small (three-four windows) application. It was fine until I added
some more lines (a QWidget::close() somewhere). When I start in debug mode
(setting the breakpoint on int main, the very first line), it is clearly
visible that this line causes a mysterious crash in Visual Studio. It looks
that the debugged application starts to do a huge number (millions) of I/O
Reads as per the Windows task manager. The actual dll which crashes is
tlloc.dll.

I use Qt 4.2.0 commercial on WinXP where this problem occurs. Has anyone
seen this behavior before?

Thanks,
Sandor

Message 2 in thread

Hadas Sandor schrieb:
> I have a small (three-four windows) application. It was fine until I 
> added some more lines (a QWidget::close() somewhere).  [...]
> 
> I use Qt 4.2.0 commercial on WinXP where this problem occurs. Has anyone 
> seen this behavior before?


Qt 4.2.2 works fine here with the same VC version. As it obviously isn't 
a problem with 4.2.0, perhaps your mentioned changes are responsible for 
the crash? Check for dangling pointers, or provide code...

Martin
-- 
 [ signature omitted ] 

Message 3 in thread

Hi There,

First line of the code means that all what has been executed are:
int main(int argc, char *argv[]) {
    QApplication app(argc, argv);

Nothing else.
No pointers, no anything.
Just the creation of the QApplication instance.

Sandor

-----Original Message-----
From: qt-interest-request@xxxxxxxxxxxxx
[mailto:qt-interest-request@xxxxxxxxxxxxx]On Behalf Of Martin Gebert
Sent: 20/12/2006 14:41
To: qt-interest@xxxxxxxxxxxxx
Subject: Re: MSVC 6.0 SP6 crashes on QApplication app(argc, argv);


Hadas Sandor schrieb:
> I have a small (three-four windows) application. It was fine until I 
> added some more lines (a QWidget::close() somewhere).  [...]
> 
> I use Qt 4.2.0 commercial on WinXP where this problem occurs. Has anyone 
> seen this behavior before?


Qt 4.2.2 works fine here with the same VC version. As it obviously isn't 
a problem with 4.2.0, perhaps your mentioned changes are responsible for 
the crash? Check for dangling pointers, or provide code...

Martin
-- 
 [ signature omitted ] 

Message 4 in thread

Hadas Sandor wrote:
>
> Hi There,
>
> First line of the code means that all what has been executed are:
> int main(int argc, char *argv[]) {
>     QApplication app(argc, argv);
>
> Nothing else.
> No pointers, no anything.
> Just the creation of the QApplication instance.
>
That might not be true.
Do you have any global objects in your code? Their constructors would be 
called before main() AFAIK.

Best,

Andre


--
 [ signature omitted ] 

Message 5 in thread

Hadas Sandor wrote:
>
> Hi There,
>
> First line of the code means that all what has been executed are:
> int main(int argc, char *argv[]) {
>     QApplication app(argc, argv);
>
> Nothing else.
> No pointers, no anything.
> Just the creation of the QApplication instance.
>
I saw a similar thing once and rebuilding the entire solution in VC++ 
solved the problem.
May not help but it's worth a try.

- Keith

--
 [ signature omitted ] 

Message 6 in thread

>> > Just the creation of the QApplication instance. <<

If that's the case, you should be able to get it to crash with 

int main(int argc, char *argv[]) {
     QApplication app(argc, argv);
}

If this doesn't crash, build up until it does crash -- rather than the
other way around.

Might be easier to diagnose if you posted the whole of your main.cpp.

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

-----Original Message-----

From: Andre Haupt [mailto:haupt.andre@xxxxxx] 
Sent: Wednesday 20 December 2006 13:13
To: qt-interest@xxxxxxxxxxxxx
Subject: Re: MSVC 6.0 SP6 crashes on QApplication app(argc, argv);

Hadas Sandor wrote:
>
> Hi There,
>
> First line of the code means that all what has been executed are:
> int main(int argc, char *argv[]) {
>     QApplication app(argc, argv);
>
> Nothing else.
> No pointers, no anything.
> Just the creation of the QApplication instance.
>
That might not be true.
Do you have any global objects in your code? Their constructors would be
called before main() AFAIK.

Best,

Andre


--
 [ signature omitted ] 

Message 7 in thread

Meantime I replaced Qt4.2.0 to Qt4.2.2 and it is still the same.

This is my main. 

#include <QApplication>
#include "tenanteditor.h"

int main(int argc, char *argv[]) {
    QApplication app(argc, argv);
    CTenantEditor widget;
    widget.show();
    return app.exec();
}

When running step by step in disassembly (I am not sure if that helps), I
see this:
1:    #include <QApplication>
2:
3:    #include "tenanteditor.h"
4:
5:    int main(int argc, char *argv[]) {
004060BB   push        ebp
004060BC   mov         ebp,esp
004060BE   push        0FFh
004060C0   push        offset $L51223 (00412aac)
004060C5   mov         eax,fs:[00000000]
004060CB   push        eax
004060CC   mov         dword ptr fs:[0],esp
004060D3   sub         esp,0C8h
6:        QApplication app(argc, argv);
004060D9   push        40202h
004060DE   mov         eax,dword ptr [argv]
004060E1   push        eax
004060E2   lea         ecx,[argc]
004060E5   push        ecx
004060E6   lea         ecx,[app]
004060EC   call        dword ptr [__imp_??0QApplication@@QAE@AAHPAPADH@Z
(0041ce98)]
004060F2   mov         dword ptr [ebp-4],0

Step into on the push after 6: and it hangs immediately followed by the
crash. Hmmm.

Cheers, Sandor


-----Original Message-----
From: qt-interest-request@xxxxxxxxxxxxx
[mailto:qt-interest-request@xxxxxxxxxxxxx]On Behalf Of Dutton, Sam
Sent: 20/12/2006 15:23
To: Andre Haupt; qt-interest@xxxxxxxxxxxxx
Subject: RE: MSVC 6.0 SP6 crashes on QApplication app(argc, argv);


>> > Just the creation of the QApplication instance. <<

If that's the case, you should be able to get it to crash with 

int main(int argc, char *argv[]) {
     QApplication app(argc, argv);
}

If this doesn't crash, build up until it does crash -- rather than the
other way around.

Might be easier to diagnose if you posted the whole of your main.cpp.

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

-----Original Message-----

From: Andre Haupt [mailto:haupt.andre@xxxxxx] 
Sent: Wednesday 20 December 2006 13:13
To: qt-interest@xxxxxxxxxxxxx
Subject: Re: MSVC 6.0 SP6 crashes on QApplication app(argc, argv);

Hadas Sandor wrote:
>
> Hi There,
>
> First line of the code means that all what has been executed are:
> int main(int argc, char *argv[]) {
>     QApplication app(argc, argv);
>
> Nothing else.
> No pointers, no anything.
> Just the creation of the QApplication instance.
>
That might not be true.
Do you have any global objects in your code? Their constructors would be
called before main() AFAIK.

Best,

Andre


--
 [ signature omitted ] 

Message 8 in thread

Hadas Sandor schrieb:
> 
> 
> Meantime I replaced Qt4.2.0 to Qt4.2.2 and it is still the same.

Also make sure you're using the latest service pack for MSVC 6 which I
believe is SP5 (or even 6 already?).

Then make sure you have the proper compiler switches, especially the
proper runtime ("Multithreaded DLL").

Cheers, Oliver

--
 [ signature omitted ] 

Message 9 in thread

Hadas Sandor schrieb:
> Meantime I replaced Qt4.2.0 to Qt4.2.2 and it is still the same.
> 
> This is my main.
> 
> #include <QApplication>
> #include "tenanteditor.h"
> 
> int main(int argc, char *argv[]) {
>     QApplication app(argc, argv);
>     CTenantEditor widget;
>     widget.show();
>     return app.exec();
> }
> 
> When running step by step in disassembly (I am not sure if that helps), 

A stacktrace from after the crash would be more helpful.
However, are you using a .pro file and qmake? If so, is your QTDIR and 
PATH set correctly? Might clear things up if you run qmake/read in the 
.pro file again. If not do you link against the correct libs (debug if 
possible)? If you're not yet using a debug config, now would be the time 
to do it...
I simply presume that the contents of argc and argv are valid.
Just raking into the fog here, as remote debugging is a thing still to 
be implemented by the newsmaster of this list... ;-)

Martin

--
 [ signature omitted ] 

Message 10 in thread

On Wednesday 20 December 2006 06:33, Hadas Sandor wrote:
> Meantime I replaced Qt4.2.0 to Qt4.2.2 and it is still the same.
>
> This is my main.
>
> #include <QApplication>
> #include "tenanteditor.h"
>
> int main(int argc, char *argv[]) {
>     QApplication app(argc, argv);
>     CTenantEditor widget;
>     widget.show();
>     return app.exec();
> }

Make sure there are no global variables in tenanteditor.h.

--
 [ signature omitted ]