[Interest] 5.4.2 Android Misery just one typo away

Nurmi J-P jpnurmi at theqtcompany.com
Mon Jun 15 19:25:34 CEST 2015


> On 15 Jun 2015, at 19:17, mark diener <rpzrpzrpz at gmail.com> wrote:
> 
> Hello list folk:
> 
> Under OSX/IOS, no problem.
> 
> Under Android, nasty and obscure segment fault 
> 
> Qt 5.4.2, NDK 10e
> 
> Do NOT under any circumstance forget the "&" before the argc parameter on the constructor
> if you override QGuiApplication (QApplication too) 
> 
> Good:
> Trpzapp::Trpzapp(int& argc, char** argv) : QGuiApplication(argc,argv)
> 
> Bad:
> Trpzapp::Trpzapp(int argc, char** argv) : QGuiApplication(argc,argv)
> 
> It WILL compile on all the platforms, runs fine on OSX/IOS Simulator, but on Android it will surely DIE.  
> 
> This maybe is a bug, or maybe just user error that is not caught by the compiler error system. (except maybe a compile warning)
> 

Hello,

It’s not a bug. It’s a documented requirement:

"Warning: The data referred to by argc and argv must stay valid for the entire lifetime of the Q*Application object.”

http://doc.qt.io/qt-5/qcoreapplication.html#QCoreApplication
http://doc.qt.io/qt-5/qguiapplication.html#QGuiApplication
http://doc.qt.io/qt-5/qapplication.html#QApplication

--
J-P Nurmi



More information about the Interest mailing list