Port away from QWidget
ClosedPublic

Authored by broulik on Feb 10 2020, 10:31 AM.

Details

Summary

We can do everything we need with QWindow

Test Plan

Alternative to D27276

  • Forced it to use the xscreensaver based one, ran the manual test, it worked
  • However, powerdevil crashes in resume on idle :(
    at /usr/lib/x86_64-linux-gnu/libxcb.so.1
#3  0x00007ffff28a706f in  ()
    at /usr/lib/x86_64-linux-gnu/libxcb.so.1
#4  0x00007ffff28a72a8 in xcb_request_check ()
    at /usr/lib/x86_64-linux-gnu/libxcb.so.1
#5  0x00007fffe831ccc2 in QXcbConnection::xi2SetMouseGrabEnabled(unsigned int, bool) (this=0x55555579d180, w=<optimized out>, grab=false) at qxcbconnection_xi2.cpp:850
#6  0x00007ffff3b460bf in WidgetBasedPoller::releaseInputLock() (this=0x555555862680)
    at /home/kaiuwe/Projekte/kf5/kidletime/src/widgetbasedpoller.cpp:92
#7  0x00007fffdc69b75d in XScreensaverBasedPoller::simulateUserActivity() (this=0x555555862680)
    at /home/kaiuwe/Projekte/kf5/kidletime/src/plugins/xscreensaver/xscreensaverbasedpoller.cpp:59
#8  0x00007ffff798da54 in PowerDevil::Core::onResumingFromIdle() ()
    at /usr/lib/x86_64-linux-gnu/libpowerdevilcore.so.2

Diff Detail

Repository
R274 KIdleTime
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik created this revision.Feb 10 2020, 10:31 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptFeb 10 2020, 10:31 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
broulik requested review of this revision.Feb 10 2020, 10:31 AM
davidedmundson added inline comments.
src/widgetbasedpoller.h
18

it's not an installed header, no need to wait

broulik added inline comments.Feb 10 2020, 10:43 AM
src/widgetbasedpoller.h
18

Ok, I'll remove this comment. Let's do the rename in a separate patch when this goes in.

davidedmundson accepted this revision.Feb 10 2020, 11:09 AM
This revision is now accepted and ready to land.Feb 10 2020, 11:09 AM

I've tested this patch in it's current form, and powerdevil no longer crashes for me on launch too. How can I reproduce crash in resume on idle? Can it be done in virtual machine?

How can I reproduce crash in resume on idle?

For me I set screen turn off to 1 minute, waited for the screen to fade to black, waited a bit more, got curious why it didn't actually turn it off, wiggled the mouse, and then found it crashed.
You might need to toggle the compositor on/off (Alt+Shift+F12) when it fades to black to remove the layer since it is stuck at this point.

I've managed to reproduce it and take a backtrace. It's an infinite recursion. Eventually stack's end is reached, although it takes some time to do it. Here's a piece of backtrace I got:

#460 0x00007ffff64dcbec in KIdleTimePrivate::_k_resumingFromIdle (this=<optimized out>) at /usr/src/debug/kidletime-5.66.0/src/kidletime.cpp:244
#461 0x00007ffff6e14143 in QMetaObject::activate (sender=0x50aa40, signalOffset=<optimized out>, local_signal_index=<optimized out>, argv=<optimized out>)
    at kernel/qobject.cpp:3803
#462 0x00007ffff7f4e9c4 in PowerDevil::Core::onResumingFromIdle (this=0x7fffe400cd30) at /usr/src/debug/powerdevil-5.17.5/daemon/powerdevilcore.cpp:820
#463 0x00007ffff7f89055 in PowerDevil::Core::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>)
    at /usr/src/debug/powerdevil-5.17.5/BUILD/daemon/powerdevilcore_autogen/EWIEGA46WW/moc_powerdevilcore.cpp:229
#464 0x00007ffff6e14143 in QMetaObject::activate (sender=0x50cac0, signalOffset=<optimized out>, local_signal_index=<optimized out>, argv=<optimized out>)
    at kernel/qobject.cpp:3803
#465 0x00007ffff64dcbec in KIdleTimePrivate::_k_resumingFromIdle (this=<optimized out>) at /usr/src/debug/kidletime-5.66.0/src/kidletime.cpp:244
#466 0x00007ffff6e14143 in QMetaObject::activate (sender=0x50aa40, signalOffset=<optimized out>, local_signal_index=<optimized out>, argv=<optimized out>)
    at kernel/qobject.cpp:3803
#467 0x00007ffff7f4e9c4 in PowerDevil::Core::onResumingFromIdle (this=0x7fffe400cd30) at /usr/src/debug/powerdevil-5.17.5/daemon/powerdevilcore.cpp:820
#468 0x00007ffff7f89055 in PowerDevil::Core::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>)
    at /usr/src/debug/powerdevil-5.17.5/BUILD/daemon/powerdevilcore_autogen/EWIEGA46WW/moc_powerdevilcore.cpp:229
#469 0x00007ffff6e14143 in QMetaObject::activate (sender=0x50cac0, signalOffset=<optimized out>, local_signal_index=<optimized out>, argv=<optimized out>)
    at kernel/qobject.cpp:3803
#470 0x00007ffff64dcbec in KIdleTimePrivate::_k_resumingFromIdle (this=<optimized out>) at /usr/src/debug/kidletime-5.66.0/src/kidletime.cpp:244
#471 0x00007ffff6e14143 in QMetaObject::activate (sender=0x50aa40, signalOffset=<optimized out>, local_signal_index=<optimized out>, argv=<optimized out>)
    at kernel/qobject.cpp:3803
#472 0x00007ffff7f4e9c4 in PowerDevil::Core::onResumingFromIdle (this=0x7fffe400cd30) at /usr/src/debug/powerdevil-5.17.5/daemon/powerdevilcore.cpp:820
#473 0x00007ffff7f89055 in PowerDevil::Core::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>)
    at /usr/src/debug/powerdevil-5.17.5/BUILD/daemon/powerdevilcore_autogen/EWIEGA46WW/moc_powerdevilcore.cpp:229
#474 0x00007ffff6e14143 in QMetaObject::activate (sender=0x50cac0, signalOffset=<optimized out>, local_signal_index=<optimized out>, argv=<optimized out>)
    at kernel/qobject.cpp:3803

I think I found source of infinite recursion.

First call is on https://phabricator.kde.org/source/powerdevil/browse/master/daemon/powerdevilcore.cpp$821
Second call is on https://phabricator.kde.org/source/kidletime/browse/master/src/plugins/xscreensaver/xscreensaverbasedpoller.cpp$62

I've removed call at line xscreensaverbasedpoller.cpp:62 and it no longer crashes for me. Not sure if anything is going to be broken by this change. I'll prepare a patch.

This revision was automatically updated to reflect the committed changes.