DevHeads.net

kio/scheduler: Does not compile with Qt from 4.8 branch

Hi,

Qt 4.8 has been branched, and (early as I am :) I tried compiling KDE with it.
It already fails compiling kdelibs/kio/kio/scheduler.cpp because of this
error:

/local/build/KDE/libs/kdelibs/kio/scheduler.moc:77:21: error: ‘class
KIO::Scheduler’ has no member named ‘schedulerPrivate’

The issue is that moc now creates this code for the
Q_PRIVATE_SLOT(schedulerPrivate, void slotSlaveDied(KIO::Slave *slave))
definition (and subsequent ones) in scheduler.h

void KIO::Scheduler::qt_static_metacall(QObject *_o, QMetaObject::Call _c,
int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
Q_ASSERT(staticMetaObject.cast(_o));
Scheduler *_t = static_cast<Scheduler *>(_o);
switch (_id) {
// ...
case 3: _t->schedulerPrivate->slotSlaveDied((*reinterpret_cast<
KIO::Slave*(*)>(_a[1]))); break;
// ...

In other words, the first argument of Q_PRIVATE_SLOT must be a member
of the class it is defined in. I stopped there, so it might fail at other
places, too.

Any ideas how to fix it?

Happy Easter,
Christoph Feck (kdepepo)

Comments

Re: kio/scheduler: Does not compile with Qt from 4.8 branch

By Thiago Macieira at 04/24/2011 - 09:04

On Sunday, 24 de April de 2011 12:53:18 Christoph Feck wrote:
Olivier, these are your moc changes.

Re: kio/scheduler: Does not compile with Qt from 4.8 branch

By Christoph Feck at 04/24/2011 - 10:42

On Sunday 24 April 2011 15:04:38 Thiago Macieira wrote:
Given that Q_PRIVATE_SLOT is a private definition, shouldn't we rather fix the
code in KDE?

Re: kio/scheduler: Does not compile with Qt from 4.8 branch

By Michael Pyne at 04/24/2011 - 21:22

On Sunday, April 24, 2011 16:42:22 Christoph Feck wrote:
Perhaps, but let's let the developers making the changes verify that this was
an intended side effect of the change. ;)

Regards,
- Michael Pyne

Re: kio/scheduler: Does not compile with Qt from 4.8 branch

By Olivier Goffart at 04/25/2011 - 18:54

Le Monday 25 April 2011, Michael Pyne a écrit :
Exactly, we rather be aware of breakage, so we can try not to break anything.

In this case, we have to see if we can fix it in Qt. I do not see any solution
on top of my head. We have to discuss if it is ok to break this use case if
there is no solution.
But it is true that this is use of private API, over which we do not support
compatibility, so i think we may keep this change in Qt, and the change can be
fixed in KDE

Re: kio/scheduler: Does not compile with Qt from 4.8 branch

By Eli MacKenzie at 06/01/2011 - 01:42

The Qt documentation, about signals and slots[1] says this:

"Since slots are normal member functions, they follow the normal C++
rules when called directly. However, as slots, they can be invoked by
any component, regardless of its access level, via a signal-slot
connection. This means that a signal emitted from an instance of an
arbitrary class can cause a private slot to be invoked in an instance
of an unrelated class."

This makes a promise that any class can use a private slot without
access checking. It doesn't say how that slot was declared, just that
the private slot can be invoked by any other class. The change to
Q_PRIVATE_SLOT introduces access checking of slots and breaks the
promise, and so it needs to be left unchanged until Qt 5.

Regards, Eli.

[1] <a href="http://doc.qt.nokia.com/latest/signalsandslots.html#slots" title="http://doc.qt.nokia.com/latest/signalsandslots.html#slots">http://doc.qt.nokia.com/latest/signalsandslots.html#slots</a>

Re: kio/scheduler: Does not compile with Qt from 4.8 branch

By Thiago Macieira at 06/01/2011 - 04:39

On Wednesday, 1 de June de 2011 01:42:13 argonel wrote:
You're assuming you're allowed to use Q_PRIVATE_SLOT. That macro is not
documented, so any use of it outside Qt is suspect by itself. Qt makes promise
of source compatibility when using it.

Re: kio/scheduler: Does not compile with Qt from 4.8 branch

By Jeremy Paul Whiting at 06/01/2011 - 10:47

Until those that know the code get this issue sorted out, I've pasted a
small workaround that gets it to build here:
<a href="http://paste.kde.org/77059/" title="http://paste.kde.org/77059/">http://paste.kde.org/77059/</a>

Jeremy

Re: kio/scheduler: Does not compile with Qt from 4.8 branch

By Dawit A at 06/01/2011 - 13:25

Isn't this problem easily solvable by changing those slots defined in
Q_PRIVATE_SLOT to actual private slots of KIO::Scheduler and
forwarding the call to the existing code ? See attached patch.

On Wed, Jun 1, 2011 at 10:47 AM, Jeremy Whiting < ... at kde dot org> wrote:

Re: kio/scheduler: Does not compile with Qt from 4.8 branch

By Olivier Goffart at 06/01/2011 - 15:02

Le Wednesday 01 June 2011, Dawit A a écrit :
there could also be a static private schedulerPrivate() function in
KIO::Scheduler, and the Q_PRIVATE_SLOT uses that function.

Re: kio/scheduler: Does not compile with Qt from 4.8 branch

By Jeremy Paul Whiting at 04/29/2011 - 14:50

Ok, Qt 4.8 has some accessibility fixes me and my gsoc student would like to
use to further push the qt-atspi development. Those involved with the
scheduler code how/when could this get fixed?

thanks,
Jeremy

Re: kio/scheduler: Does not compile with Qt from 4.8 branch

By Jeremy Paul Whiting at 05/16/2011 - 15:23

Ping,

Anyone know who should/can fix this issue? I've got a hack locally, but a
proper fix would be very good imho.

Jeremy