Possible KUniqueApplication and KCmdLineArgs issue

Christian Esken esken at kde.org
Wed Aug 10 21:51:05 BST 2005


Am Mittwoch, 10. August 2005 13:52 schrieb Waldo Bastian:
> On Wednesday 10 August 2005 02:17, Christian Esken wrote:
> > Hello all,
> >
> > I am encountering a strange behaviour with KCmdLineArgs and KMix (a
> > KUniqueApplication). I am quite aware that this is just a small issue, and
> > could possibly simply be solved by enhancing the API docs. Still, somebody
> > knowledgable with these classes should look into it.
> >
> > Lets go:
> > 1) The current KMix has no command line options. This works fine.
> >
> > 2) In my working copy I added a "keepvisibility" option to KMix. But with
> > this I receive: kmix: kcmdlineargs.cpp:231: static void
> > KCmdLineArgs::addCmdLineOptions(const KCmdLineOptions*, const char*, const
> > char*, const char*): Assertion `parsed == false' failed.
> >
> > 3) I have not called "KUniqueApplication::addCmdLineOptions()" , and if I
> > add this statement, everything is fine. So my personal problem is solved.
> >
> > Butttttt! Why does the assertion fail?!?
> 
> You must add all command line options before you use them with 
> KCmdLineArgs::parsedArgs(). Normally KUniqueApplication::addCmdLineOptions() 
> is called in KUniqueApplication::start() or the KUniqueApplication 
> constructor but if you want to use command line options before that you must 
> add the KUniqueApplication command line options yourself before you use them. 

So my supicision was right: KUniqueApplication::addCmdLineOptions() is called "implictely".

> Feel free to update the API-docs to make this more clear.

OK. Any objections to commit this?

  Chris



Index: kuniqueapplication.h
===================================================================
--- kuniqueapplication.h        (Revision 425091)
+++ kuniqueapplication.h        (Arbeitskopie)
@@ -130,6 +130,9 @@
    * called automatically before creating KUniqueApplication if it hasn't
    * been called yet, without any performance impact.
    *
+   * Also note that you MUST call KUniqueApplication::addCmdLineOptions(),
+   * if you use command line options before start() is called.
+   *
    * @return true if registration is successful.
    *         false if another process was already running.
    */





More information about the kde-core-devel mailing list