From ab810a1fe763649fbacb47ae1208aefb7ea171c0 Mon Sep 17 00:00:00 2001 From: Dan Vrátil Date: Apr 22 2014 11:23:58 +0000 Subject: Backport upstream crash fix Resolves: rhbz#998395 rhbz#1004558 rhbz#1016769 rhbz#1023816 --- diff --git a/0002-keep-xrandroutput-cache-up-to-date.patch b/0002-keep-xrandroutput-cache-up-to-date.patch new file mode 100644 index 0000000..bbf1fb2 --- /dev/null +++ b/0002-keep-xrandroutput-cache-up-to-date.patch @@ -0,0 +1,34 @@ +commit de38db6b97264a82dca25f7e663ff2e8791bc804 +Author: Dan Vrátil +Date: Tue Apr 1 18:30:24 2014 +0200 + + Update XRandROutput after it's disabled so that cache is kept up-to-date + + After disabling an output, we have to force-update the XRandROutput, because right + after that we receive RRNotify_CRTCChange signal for that very output. This is + propagated to users (like KCM), which then call canBeApplied(). canBeApplied() + compares the KScreen::Config with the *outdated* XRandRConfig and that leads to + a crash (because the XRandRConfig still claims that the output is enabled). + + By updating the cache right after we disable the output, when KCM calls canBeApplied(), + it's Config is compared to an up-to-date Config and everything is fine. + + REVIEW: 117298 + +diff --git a/backends/xrandr/xrandrconfig.cpp b/backends/xrandr/xrandrconfig.cpp +index 04b37bd..c28250c 100644 +--- a/backends/xrandr/xrandrconfig.cpp ++++ b/backends/xrandr/xrandrconfig.cpp +@@ -507,6 +507,12 @@ bool XRandRConfig::disableOutput(Output* output) const + 0, 0, None, RR_Rotate_0, NULL, 0); + + kDebug(dXndr()) << "XRRSetCrtcConfig() returned" << s; ++ ++ // Update the cached output now, otherwise we get RRNotify_CrtcChange notification ++ // for an outdated output, which can lead to a crash. ++ if (s == RRSetConfigSuccess) { ++ m_outputs.value(output->id())->update(); ++ } + return (s == RRSetConfigSuccess); + } + diff --git a/libkscreen.spec b/libkscreen.spec index 6d2070f..6015168 100644 --- a/libkscreen.spec +++ b/libkscreen.spec @@ -1,7 +1,7 @@ Name: libkscreen Epoch: 1 Version: 1.0.2 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Display configuration library License: GPLv2+ @@ -11,6 +11,7 @@ Source0: http://download.kde.org/stable/libkscreen/%{version}/src/libkscr ## upstream patches Patch0001: 0001-fix-pkgconfig-Version.patch +Patch0002: 0002-keep-xrandroutput-cache-up-to-date.patch BuildRequires: kdelibs4-devel BuildRequires: libXrandr-devel @@ -33,6 +34,7 @@ developing applications that use %{name}. %setup -q %patch0001 -p1 -b .0001 +%patch0002 -p1 -b .0002 %build mkdir -p %{_target_platform} @@ -70,6 +72,10 @@ test "$(pkg-config --modversion kscreen)" = "%{version}" %changelog +* Tue Apr 22 2014 Daniel Vrátil - 1:1.0.2-3 +- backport upstream crash fix +- Resolves: rhbz#998395 rhbz#1004558 rhbz#1016769 rhbz#1023816 + * Mon Nov 25 2013 Rex Dieter - 1:1.0.2-2 - backport pkgconfig fix (verify in %%check) - track soname