Use an xcb for interaction with KStartupInfo

Review Request #126313 - Created Dec. 11, 2015 and submitted

Information
Martin Flöser
kinit
master
126312
126314
Reviewers
kdeframeworks
dfaure
By changing to xcb we can use NETRootInfo to get the current desktop
and don't need to duplicate the logic. Also it means that more code
is ported from XLib to xcb and might allow us to drop the XLib
dependency in future.

  
David Faure
Martin Flöser
Review request changed

Status: Closed (submitted)

Change Summary:

Submitted with commit 527c3490a867b7a0a22a45a8d5d7a706578f9503 by Martin Gräßlin to branch master.
Luca Beltrame

FYI, this breaks Plasma 5 startup completely for me. kinit crashes with

#0  0x00007ff831e58c20 in QObject::thread() const () at /usr/lib64/libQt5Core.so.5
#1  0x00007ff8329d1a20 in KWindowSystem::d_func() () at /usr/lib64/libKF5WindowSystem.so.5
#2  0x00007ff8329d2cc9 in KWindowSystem::mapViewport() () at /usr/lib64/libKF5WindowSystem.so.5
#3  0x00007ff8329dce02 in NETRootInfo::currentDesktop(bool) const () at /usr/lib64/libKF5WindowSystem.so.5
#4  0x0000000000408d09 in launch(int, char const*, char const*, char const*, int, char const*, bool, char const*, bool, char const*) (this=0x8e4458)
    at /usr/include/qt5/QtCore/qbytearray.h:485
#5  0x0000000000408d09 in launch(int, char const*, char const*, char const*, int, char const*, bool, char const*, bool, char const*) (this=0x8e4458)
    at /usr/include/qt5/QtCore/qbytearray.h:479
#6  0x0000000000408d09 in launch(int, char const*, char const*, char const*, int, char const*, bool, char const*, bool, char const*) (argc=32767, _name=0x7ffffdb02e20 "\020c\215", args=0x8e446b "/home/lb", cwd=<optimized out>, envc=<optimized out>, envs=<optimized out>, reset_env=false, tty=0x8e55b0 "", avoid_loops=160, startup_id_str=0x1161 <error: Cannot access memory at address 0x1161>)
    at /home/lb/Coding/KDEsrc/kinit/src/kdeinit/kinit.cpp:643
#7  0x00000000008e559d in  ()
#8  0x0000000000000000 in  ()

I had to revert it or kdeinit would crash and prevent me from having a functional session. ;)

  1. Same here.

  2. sorry about that, I'm on it.

  3. The problem is that kinit is not a QCoreApplication and it crashes when accessing the ::instance(). A possible workaround for kinit is (not yet tested):

    diff --git a/src/kdeinit/kinit.cpp b/src/kdeinit/kinit.cpp
    index 9919547..8b5c926 100644
    --- a/src/kdeinit/kinit.cpp
    +++ b/src/kdeinit/kinit.cpp
    @@ -375,7 +375,7 @@ static void init_startup_info(KStartupInfoId &id, const QByteArray &bin,
         X11_startup_notify_fd = xcb_get_file_descriptor(s_startup_notify_connection);
         NETRootInfo rootInfo(s_startup_notify_connection, NET::CurrentDesktop);
         KStartupInfoData data;
    -    data.setDesktop(rootInfo.currentDesktop());
    +    data.setDesktop(rootInfo.currentDesktop(true));
         data.setBin(QFile::decodeName(bin));
         KStartupInfo::sendChangeXcb(s_startup_notify_connection, s_startup_notify_screen, id, data);
         xcb_flush(s_startup_notify_connection);
    

    I'll also try to harden KWindowSystem against that.

  4. pushed that with http://commits.kde.org/kinit/e39bd4eb3d39a19543841eda6188118f58382ab6 - thanks to Elias and Luca for giving me good backtraces and testing.

Loading...