Bug 352462

Summary: PowerDevilUPowerBackend makes unconditional call to xrandr extension
Product: [Plasma] Powerdevil Reporter: Thomas Lübking <thomas.luebking>
Component: generalAssignee: Plasma Development Mailing List <plasma-devel>
Status: RESOLVED FIXED    
Severity: normal CC: alexandernst, barry, bernd.amend, kde, mjmeehan, rdieter
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=343844
Latest Commit: Version Fixed In: 5.5.1
Sentry Crash Report:

Description Thomas Lübking 2015-09-09 06:56:37 UTC
xcb_randr_query_version isn't legal either.
This causes kded to crash if the randr extensio isn't available (usually xinerama setups)
See bug #343844

generic test:

xcb_prefetch_extension_data(connection, &xcb_randr_id);
xcb_query_extension_reply_t *extension = xcb_get_extension_data(connection, &xcb_randr_id);
m_randr_available = extension && extension->present;

---

Backtrace:

> Breakpoint 9, 0x00007f1d239b82d0 in xcb_randr_query_version@plt () from
> /usr/lib/qt/plugins/kded_powerdevil.so
> (gdb) thread apply all bt 100
> 
> Thread 2 (Thread 0x7f1d2a1c7700 (LWP 18058)):
> #0  0x00007f1d3fdf618d in poll () from /usr/lib/libc.so.6
> #1  0x00007f1d3f2e99f2 in ?? () from /usr/lib/libxcb.so.1
> #2  0x00007f1d3f2eb56f in xcb_wait_for_event () from /usr/lib/libxcb.so.1
> #3  0x00007f1d2c52fca9 in ?? () from /usr/lib/libQt5XcbQpa.so.5
> #4  0x00007f1d40174a9e in ?? () from /usr/lib/libQt5Core.so.5
> #5  0x00007f1d3d7344a4 in start_thread () from /usr/lib/libpthread.so.0
> #6  0x00007f1d3fdff13d in clone () from /usr/lib/libc.so.6
> 
> Thread 1 (Thread 0x7f1d41a3b800 (LWP 18052)):
> #0  0x00007f1d239b82d0 in xcb_randr_query_version@plt () from
> /usr/lib/qt/plugins/kded_powerdevil.so
> #1  0x00007f1d239cd15f in ?? () from /usr/lib/qt/plugins/kded_powerdevil.so
> #2  0x00007f1d239c4553 in PowerDevilUPowerBackend::init() () from
> /usr/lib/qt/plugins/kded_powerdevil.so
> #3  0x00007f1d2377b747 in
> PowerDevil::Core::loadCore(PowerDevil::BackendInterface*) () from
> /usr/lib/libpowerdevilcore.so.2
> #4  0x00007f1d239b994f in ?? () from /usr/lib/qt/plugins/kded_powerdevil.so
> #5  0x00007f1d40384eb1 in QObject::event(QEvent*) () from
> /usr/lib/libQt5Core.so.5
> #6  0x00007f1d3e9a300c in QApplicationPrivate::notify_helper(QObject*,
> QEvent*) () from /usr/lib/libQt5Widgets.so.5
> #7  0x00007f1d3e9a84e6 in QApplication::notify(QObject*, QEvent*) () from
> /usr/lib/libQt5Widgets.so.5
> #8  0x00007f1d4035589b in QCoreApplication::notifyInternal(QObject*,
> QEvent*) () from /usr/lib/libQt5Core.so.5
> #9  0x00007f1d40357c96 in
> QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) ()
> from /usr/lib/libQt5Core.so.5
> #10 0x00007f1d403abe33 in ?? () from /usr/lib/libQt5Core.so.5
> #11 0x00007f1d3ca099fd in g_main_context_dispatch () from
> /usr/lib/libglib-2.0.so.0
> #12 0x00007f1d3ca09ce0 in ?? () from /usr/lib/libglib-2.0.so.0
> #13 0x00007f1d3ca09d8c in g_main_context_iteration () from
> /usr/lib/libglib-2.0.so.0
> #14 0x00007f1d403ac23f in
> QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
> () from /usr/lib/libQt5Core.so.5
> #15 0x00007f1d4035326a in
> QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from
> /usr/lib/libQt5Core.so.5
> #16 0x00007f1d4035b20c in QCoreApplication::exec() () from
> /usr/lib/libQt5Core.so.5
> #17 0x00007f1d2c9efb64 in kdemain () from /usr/lib/libkdeinit5_kded5.so
> #18 0x000000000040856a in ?? ()
> #19 0x000000000040585f in main ()
> (gdb) continue
> 
> Breakpoint 19, 0x00007f1d239b8d40 in xcb_randr_query_version_reply@plt ()
> from /usr/lib/qt/plugins/kded_powerdevil.so
> (gdb) continue
> Continuing.
> [Thread 0x7f1d2a1c7700 (LWP 18058) exited]
> [New Thread 0x7f1d2a1c7700 (LWP 18229)]
> warning: Temporarily disabling breakpoints for unloaded shared library
> "/usr/lib/libQt5XcbQpa.so.5"
> [Thread 0x7f1d41a3b800 (LWP 18052) exited]
> [Inferior 1 (process 18052) exited with code 01]
> (gdb) 
> 

Reproducible: Always
Comment 1 Kai Uwe Broulik 2015-12-13 20:44:46 UTC
Git commit dde0ecce02259a26655737e6674950e2e303bc6f by Kai Uwe Broulik.
Committed on 13/12/2015 at 20:15.
Pushed by broulik into branch 'Plasma/5.5'.

[XRandRBrightness] Don't call for xrandr if it's not available

Check whether the extension is available before calling into it.

REVIEW: 126146
FIXED-IN: 5.5.1

M  +9    -0    daemon/backends/upower/xrandrbrightness.cpp

http://commits.kde.org/powerdevil/dde0ecce02259a26655737e6674950e2e303bc6f