Similar to c4cfeb6bbf8d, avoid crashes due to bad references.

Make sure argc is always valid when QCoreApplication access it, by keeping
it as a reference to argc from main.
Merge pull request #243 from MJDSys/argc_fix

Similar to c4cfeb6bbf8d, avoid crashes due to bad references.