dcop incompatibility?

Waldo Bastian bastian at kde.org
Sun Feb 27 22:57:24 GMT 2005


On Sunday 27 February 2005 23:03, Michael Reiher wrote:
> On Sunday 27 February 2005 17:06, Waldo Bastian wrote:
> > On Sunday 27 February 2005 13:36, Michael Reiher wrote:
> > > Hi!
> > >
> > > The old Kwintv uses:
> > >
> > >   QByteArray data;
> > >   m_bHaveKDESaver = kapp->dcopClient()->findObject("kdesktop",
> > >                                                    "KScreensaverIface",
> > >                                                    "enable(bool)",
> > >                                                    data,
> > >                                                    m_screenSaverApp,
> > >                                                    m_screenSaverObj);
> > >
> > > to detect whether there is a KDE screensaver available. This used to
> > > work fine. But recently I noticed, that it obviously doesn't
> > > anymore(and thus the screensaver, isn't disabled anymore). findObject()
> > > apparently doesn't return true anymore, even though the dcop object
> > > exists. So, has dcop/dcopclient changed in an incompatible way?
> >
> > The above snippet suggests that you call a function that takes a bool as
> > argument, but you don't seem to pass any arguments at all to it. I think
>
> That's right. The purpose was just to find out, whether such an object,
> having such a function exists.
>
> > DCOP now catches that case and fails. Previously it could crash in such
> > situation (with types other than bool).
>
> Ah, ok. Although I wonder how should I achieve the above, without actually
> calling that function (which is what the name findObject() suggests;)??

I suggest you read the API docs for findObject(). There is no function to 
check whether a function exists, but findObject can tell you if an object 
exists. I don't know why kwintv needs to know about the function... typically 
you would just call the function when you actually need it, and you will get 
an errorcode back at that point if the function doesn't happen to exist.

> OTOH, even though this looks indeed like a kwintv bug, the question is
> whether other applications rely on this specific behavior? Shouldn't it
> simply return true if the argument is empty, in order to keep the current
> behavior until KDE4?

No, the application is just plain broken and should be fixed. It was lucky it 
got away with it up till now.

Cheers,
Waldo
-- 
bastian at kde.org   |   Free Novell Linux Desktop 9 Evaluation Download
bastian at suse.com  |   http://www.novell.com/products/desktop/eval.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20050227/3930378e/attachment.sig>


More information about the kde-core-devel mailing list