QFtp strange behaviour.
-
Hi, I'm writing to see if anyone can explain a very weird behaviour of QFtp.
A while ago I wrote a Qt application that uses QFtp (wrote and tested using Windows 7). Now I get feedback from
some people that the application is crashing on start-up on their Windows XP machines.
I set up a Windows XP environment and found out that it crashed for me too.In the code, I have a class that inherits from QFtp, and I found out that the crashing happens right
when I access any methods from my newly created object:@
ftp = new FtpConnection(appSettings, this);connect(ftp,SIGNAL(newTransferProgress(int,int)),this,SLOT(uploadProgressUpdate(int,int)));
@
The initial crashing happened on the connect line, so I changed the code:
@
ftp = new FtpConnection(appSettings, this);ftp->state(); connect(ftp,SIGNAL(newTransferProgress(int,int)),this,SLOT(uploadProgressUpdate(int,int)));
@
And it crashed on the state() calling line, as if it 'ftp' were pointing to invalid memory.
I started printing with QDebug the actual address held by 'ftp', long story short, the QDebug statement
somehow made 'ftp' a valid pointer:On DEBUG mode, the application doesn't crash if I have it like this:
@
qDebug() << ftp;
ftp = new FtpConnection(appSettings, this);
qDebug() << ftp;connect(ftp,SIGNAL(newTransferProgress(int,int)),this,SLOT(uploadProgressUpdate(int,int)));
@
The previous code didn't work for RELEASE, so I had to change it again:
@
ftp = new FtpConnection(appSettings, this);
qDebug() << ftp;connect(ftp,SIGNAL(newTransferProgress(int,int)),this,SLOT(uploadProgressUpdate(int,int)));
@
The application is running now without crashing, but I'm very surprised by the way it
got unintentionally fixed...Am I overlooking something here?
Could someone give an explanation of what's going on?Thank you,
Sergio
-
Something inside the FtpConnection class is not being initialised and causes the crash when used. Without seeing that code we cannot possibly diagnose this. Running it in your debugger on the crashing machine will fairly quickly tell you exactly where it is breaking.
-
Hi, that's for your answer. I'm pretty sure it crashed
on Qt code.