Hello community,

here is the log from the commit of package libkscreen2 for openSUSE:Factory 
checked in at 2015-05-29 10:19:07
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libkscreen2 (Old)
 and      /work/SRC/openSUSE:Factory/.libkscreen2.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libkscreen2"

Changes:
--------
--- /work/SRC/openSUSE:Factory/libkscreen2/libkscreen2.changes  2015-05-11 
19:30:31.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.libkscreen2.new/libkscreen2.changes     
2015-05-29 10:19:09.000000000 +0200
@@ -1,0 +2,8 @@
+Fri May 22 15:29:56 UTC 2015 - [email protected]
+
+- Update to 5.3.1:
+  * Bugfix release
+  * For more details please see:
+    https://www.kde.org/announcements/plasma-5.3.1.php
+
+-------------------------------------------------------------------

Old:
----
  libkscreen-5.3.0.tar.xz

New:
----
  libkscreen-5.3.1.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libkscreen2.spec ++++++
--- /var/tmp/diff_new_pack.d6qTlu/_old  2015-05-29 10:19:10.000000000 +0200
+++ /var/tmp/diff_new_pack.d6qTlu/_new  2015-05-29 10:19:10.000000000 +0200
@@ -19,7 +19,7 @@
 %define lname   libKF5Screen6
 %define plasma_version 5.0.0
 Name:           libkscreen2
-Version:        5.3.0
+Version:        5.3.1
 Release:        0
 BuildRequires:  cmake >= 2.8.12
 BuildRequires:  extra-cmake-modules >= 0.0.12

++++++ libkscreen-5.3.0.tar.xz -> libkscreen-5.3.1.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libkscreen-5.3.0/CMakeLists.txt 
new/libkscreen-5.3.1/CMakeLists.txt
--- old/libkscreen-5.3.0/CMakeLists.txt 2015-04-23 12:04:35.000000000 +0200
+++ new/libkscreen-5.3.1/CMakeLists.txt 2015-05-21 18:59:03.000000000 +0200
@@ -1,5 +1,5 @@
 project(libkscreen)
-set(PROJECT_VERSION "5.3.0")
+set(PROJECT_VERSION "5.3.1")
 
 cmake_minimum_required(VERSION 2.8.12)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libkscreen-5.3.0/backends/xrandr/xrandrconfig.cpp 
new/libkscreen-5.3.1/backends/xrandr/xrandrconfig.cpp
--- old/libkscreen-5.3.0/backends/xrandr/xrandrconfig.cpp       2015-04-23 
12:04:35.000000000 +0200
+++ new/libkscreen-5.3.1/backends/xrandr/xrandrconfig.cpp       2015-05-21 
18:59:03.000000000 +0200
@@ -122,6 +122,15 @@
     const KScreen::OutputList kscreenOutputs = config->outputs();
     const QSize newScreenSize = screenSize(config);
     const QSize currentScreenSize = m_screen->currentSize();
+    // When the current screen configuration is bigger than the new size (like
+    // when rotating an output), the XSetScreenSize can fail or apply the 
smaller
+    // size only partially, because we apply the size (we have to) before the
+    // output changes. To prevent all kinds of weird screen sizes from 
happening,
+    // we initially set such screen size, that it can take the current as well
+    // as the new configuration, then we apply the output changes, and finally 
then
+    // (if necessary) we reduce the screen size to fix the new configuration 
precisely.
+    const QSize intermediateScreenSize = QSize(qMax(newScreenSize.width(), 
currentScreenSize.width()),
+                                               qMax(newScreenSize.height(), 
currentScreenSize.height()));
     int neededCrtcs = 0;
     xcb_randr_output_t primaryOutput = 0;
     xcb_randr_output_t oldPrimaryOutput = 0;
@@ -226,6 +235,7 @@
     qCDebug(KSCREEN_XRANDR) << "\tChange Screen Size:" << (newScreenSize != 
currentScreenSize);
     if (newScreenSize != currentScreenSize) {
         qCDebug(KSCREEN_XRANDR) << "\t\tOld:" << currentScreenSize;
+        qCDebug(KSCREEN_XRANDR) << "\t\tIntermediate:" << 
intermediateScreenSize;
         qCDebug(KSCREEN_XRANDR) << "\t\tNew:" << newScreenSize;
     }
     qCDebug(KSCREEN_XRANDR) << "\tDisable outputs:" << !toDisable.isEmpty();
@@ -257,8 +267,8 @@
         disableOutput(output);
     }
 
-    if (newScreenSize != currentScreenSize) {
-        setScreenSize(newScreenSize);
+    if (intermediateScreenSize != currentScreenSize) {
+        setScreenSize(intermediateScreenSize);
     }
 
     bool forceScreenSizeUpdate = false;
@@ -286,9 +296,14 @@
         setPrimaryOutput(primaryOutput);
     }
 
-    if (forceScreenSizeUpdate) {
-        const QSize newSize = screenSize(config);
-        qCDebug(KSCREEN_XRANDR) << "forced to change screen size: " << newSize;
+    if (forceScreenSizeUpdate || intermediateScreenSize != newScreenSize) {
+        QSize newSize;
+        if (forceScreenSizeUpdate) {
+            newSize = screenSize(config);
+            qCDebug(KSCREEN_XRANDR) << "Forced to change screen size: " << 
newSize;
+        } else {
+            newSize = intermediateScreenSize;
+        }
         setScreenSize(newSize);
     }
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libkscreen-5.3.0/src/backendlauncher/backendloader.cpp 
new/libkscreen-5.3.1/src/backendlauncher/backendloader.cpp
--- old/libkscreen-5.3.0/src/backendlauncher/backendloader.cpp  2015-04-23 
12:04:35.000000000 +0200
+++ new/libkscreen-5.3.1/src/backendlauncher/backendloader.cpp  2015-05-21 
18:59:03.000000000 +0200
@@ -26,13 +26,25 @@
 #include <QPluginLoader>
 #include <QX11Info>
 
+#include <memory>
+
 #include <QDBusConnection>
 #include <QDBusInterface>
 
 Q_LOGGING_CATEGORY(KSCREEN_BACKEND_LAUNCHER, "kscreen.backendLauncher")
 
+void pluginDeleter(QPluginLoader *p)
+{
+    if (p) {
+        qCDebug(KSCREEN_BACKEND_LAUNCHER) << "Unloading" << p->fileName();
+        p->unload();
+        delete p;
+    }
+}
+
 BackendLoader::BackendLoader()
     : QObject()
+    , mLoader(0)
     , mBackend(0)
 {
 }
@@ -40,6 +52,8 @@
 BackendLoader::~BackendLoader()
 {
     delete mBackend;
+    pluginDeleter(mLoader);
+    qCDebug(KSCREEN_BACKEND_LAUNCHER) << "Backend loader destroyed";
 }
 
 bool BackendLoader::loadBackend(const QString& backend)
@@ -77,12 +91,11 @@
             }
 
             qCDebug(KSCREEN_BACKEND_LAUNCHER) << "Trying" << finfo.filePath();
-            QPluginLoader loader(finfo.filePath());
-            loader.load();
-            QObject *instance = loader.instance();
+            // Make sure we unload() and delete the loader whenever it goes 
out of scope here
+            std::unique_ptr<QPluginLoader, void(*)(QPluginLoader *)> 
loader(new QPluginLoader(finfo.filePath()), pluginDeleter);
+            QObject *instance = loader->instance();
             if (!instance) {
-                qCDebug(KSCREEN_BACKEND_LAUNCHER) << loader.errorString();
-                loader.unload();
+                qCDebug(KSCREEN_BACKEND_LAUNCHER) << loader->errorString();
                 continue;
             }
 
@@ -92,9 +105,12 @@
                     qCDebug(KSCREEN_BACKEND_LAUNCHER) << "Skipping" << 
mBackend->name() << "backend";
                     delete mBackend;
                     mBackend = 0;
-                    loader.unload();
                     continue;
                 }
+
+                // This is the only case we don't want to unload() and delete 
the loader, instead
+                // we store it and unload it when the backendloader terminates.
+                mLoader = loader.release();
                 qCDebug(KSCREEN_BACKEND_LAUNCHER) << "Loading" << 
mBackend->name() << "backend";
                 return true;
             } else {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libkscreen-5.3.0/src/backendlauncher/backendloader.h 
new/libkscreen-5.3.1/src/backendlauncher/backendloader.h
--- old/libkscreen-5.3.0/src/backendlauncher/backendloader.h    2015-04-23 
12:04:35.000000000 +0200
+++ new/libkscreen-5.3.1/src/backendlauncher/backendloader.h    2015-05-21 
18:59:03.000000000 +0200
@@ -23,6 +23,8 @@
 #include <QObject>
 #include <QLoggingCategory>
 
+class QPluginLoader;
+
 namespace KScreen
 {
 class AbstractBackend;
@@ -49,7 +51,7 @@
     KScreen::AbstractBackend* backend() const;
 
 private:
-
+    QPluginLoader *mLoader;
     KScreen::AbstractBackend* mBackend;
 };
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libkscreen-5.3.0/src/configoperation.cpp 
new/libkscreen-5.3.1/src/configoperation.cpp
--- old/libkscreen-5.3.0/src/configoperation.cpp        2015-04-23 
12:04:35.000000000 +0200
+++ new/libkscreen-5.3.1/src/configoperation.cpp        2015-05-21 
18:59:03.000000000 +0200
@@ -24,7 +24,8 @@
 using namespace KScreen;
 
 ConfigOperationPrivate::ConfigOperationPrivate(ConfigOperation* qq)
-    : QObject(0)
+    : QObject()
+    , isExec(false)
     , q_ptr(qq)
 {
 }
@@ -53,7 +54,16 @@
     Q_Q(ConfigOperation);
 
     Q_EMIT q->finished(q);
-    q->deleteLater();
+
+    // Don't call deleteLater() when this operation is running from exec()
+    // because then the operation will be deleted when we return control to
+    // the nested QEventLoop in exec() (i.e. before loop.exec() returns)
+    // and subsequent hasError() call references deleted "this". Instead we
+    // shedule the operation for deletion manually in exec(), so that it will
+    // be deleted when control returns to parent event loop (or QApplication).
+    if (!isExec) {
+        q->deleteLater();
+    }
 }
 
 ConfigOperation::ConfigOperation(ConfigOperationPrivate* dd, QObject* parent)
@@ -98,13 +108,19 @@
 
 bool ConfigOperation::exec()
 {
+    Q_D(ConfigOperation);
+
     QEventLoop loop;
     connect(this, &ConfigOperation::finished,
             [&](ConfigOperation *op) {
                 Q_UNUSED(op);
                 loop.quit();
             });
+
+    d->isExec = true;
     loop.exec(QEventLoop::ExcludeUserInputEvents);
 
+    // Schedule the operation for deletion, see doEmitResult()
+    deleteLater();
     return !hasError();
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libkscreen-5.3.0/src/configoperation_p.h 
new/libkscreen-5.3.1/src/configoperation_p.h
--- old/libkscreen-5.3.0/src/configoperation_p.h        2015-04-23 
12:04:35.000000000 +0200
+++ new/libkscreen-5.3.1/src/configoperation_p.h        2015-05-21 
18:59:03.000000000 +0200
@@ -41,6 +41,7 @@
 
 private:
     QString error;
+    bool isExec;
 
 protected:
     ConfigOperation * const q_ptr;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libkscreen-5.3.0/src/getconfigoperation.cpp 
new/libkscreen-5.3.1/src/getconfigoperation.cpp
--- old/libkscreen-5.3.0/src/getconfigoperation.cpp     2015-04-23 
12:04:35.000000000 +0200
+++ new/libkscreen-5.3.1/src/getconfigoperation.cpp     2015-05-21 
18:59:03.000000000 +0200
@@ -71,7 +71,9 @@
     }
 
     QDBusPendingCallWatcher *watcher = new 
QDBusPendingCallWatcher(backend->getConfig(), this);
-    watcher->setProperty("backend", QVariant::fromValue(backend));
+
+    const auto backendPointer = QPointer<org::kde::kscreen::Backend>(backend);
+    watcher->setProperty("backend", QVariant::fromValue(backendPointer));
     connect(watcher, &QDBusPendingCallWatcher::finished,
             this, &GetConfigOperationPrivate::onConfigReceived);
 }
@@ -101,7 +103,12 @@
     }
 
     pendingEDIDs = 0;
-    org::kde::kscreen::Backend *backend = 
watcher->property("backend").value<org::kde::kscreen::Backend*>();
+    auto backend = 
watcher->property("backend").value<QPointer<org::kde::kscreen::Backend>>();
+    if (!backend) {
+        q->setError(tr("Backend invalidated"));
+        q->emitResult();
+        return;
+    }
     Q_FOREACH (const OutputPtr &output, config->outputs()) {
         if (!output->isConnected()) {
             continue;


Reply via email to