[Interest] QApplication fails to start on release mode when using Qt as a backend of a plugin (Windows)

Tim Blechmann tim at klingt.org
Thu Sep 17 14:06:44 CEST 2015

> Im having a really awkward situation when trying to start QApplication 
> inside a plugin. Everything works in debug mode. I have struggled a bit 
> on debug mode to get rid of an ASSERTION warning: 
> Q_ASSERT(allArguments.size() == origArgc);
> When I sucessfully managed to inject the very same argc and argv into 
> QApplication constructor everything started fine on debug build. This is 
> the code I'm using to fetch the command line args and start QApplication:
> // defined as global variables
> static int argc;
> static char **argv;
> LPWSTR *argvv = CommandLineToArgvW(GetCommandLineW(), &argc);
> argv = new char*[argc];
> argv[0] = 
> qstrdup(QString::fromStdWString(argvv[0]).toLocal8Bit().constData());
> qDebug("Before QApplication constructor: %s",argv[0]);
> app = new QApplication(argc, argv);
> qDebug("After QApplication constructor)";
> The problem is that on Release build, the plugin crashes as soon as it 
> is initiliazed and I can't understand why. The only thing I have is the 
> vague output:
> Before QApplication constructor: C:\ProgramData\Ableton\Live 9 
> Standard\Program\Ableton Live 9 Standard.exe
> First-chance exception at 0x148AC104 (drc.dll) in Ableton Live 9 
> Standard.exe: 0xC0000005: Access violation reading location 0x00000000.
> It seems that it is trying to access a null pointer.
> Any ideas of what might be happening here?


More information about the Interest mailing list