Problem with KCmdLineArgs::init( argc, argv, &aboutData, true )

Tobias Koenig tokoe at kde.org
Wed Feb 18 15:37:29 GMT 2004


Hi,

the following code

  KCmdLineArgs::init( argc, argv, &aboutData, true );
  KCmdLineArgs::addCmdLineOptions( options );

  KApplication app( false, false );

will result in an error message:

  kcmdlineargs.cpp:702: static char*** KCmdLineArgs::qt_argv():  Assertion 'args' failed

The problem is the following:
Because of the 4th parameter in the ::init call,
KApplication::addCmdLineArgs() isn't called, so the global args
list doesn't contain the arguments for Qt.
In KCmdLineArgs::addCmdLineOptions( options ) you add your own options
to the global args list, so it's not empty anymore.

In the ctor of KApplication( bool, bool ) KCmdLineArgs::qt_argv() is
called with the following code:

  if (!argsList )
    KApplication::addCmdLineArgs();

  KCmdLineArgs *args = parsedArgs( "qt" );
  assert(args); // No qt options have been added!

Well, of course no Qt options have been added, for this reason I passed
'true' as 4th parameter in ::init...
Could we remove the assert here or rewrite the code somewhere else to
allow cmdline applications to omit the Qt/KDE arguments but register its
own ones?

Ciao,
Tobias
-- 
Separate politics from religion and economy!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20040218/54021160/attachment.sig>


More information about the kde-core-devel mailing list