[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kde-workspace] kwin/clients/oxygen/config: [oxygen/config] Use a pointer for the KWindowInfo member
From:       Martin_Gräßlin <mgraesslin () kde ! org>
Date:       2014-02-01 8:02:56
Message-ID: E1W9VXU-00051A-24 () scm ! kde ! org
[Download RAW message or body]

Git commit 83114ea4dc2950b5e25445bae66c3f855cb427a4 by Martin Gräßlin.
Committed on 01/02/2014 at 07:58.
Pushed by graesslin into branch 'master'.

[oxygen/config] Use a pointer for the KWindowInfo member variable

The reason for this change is that the default ctor of KWindowInfo
creates a broken object. Calling any method in it will result in a
crush. Thus it is scheduled for removal in kwindowsystem framework
causing this code to no longer compile.

The solution is to use a pointer and set it to null as long as the
window has not been detected yet.

This is the same change as done for kcm kwinrules. And here we se
why copying code is bad ;-)

M  +5    -5    kwin/clients/oxygen/config/oxygendetectwidget.cpp
M  +2    -2    kwin/clients/oxygen/config/oxygendetectwidget.h

http://commits.kde.org/kde-workspace/83114ea4dc2950b5e25445bae66c3f855cb427a4

diff --git a/kwin/clients/oxygen/config/oxygendetectwidget.cpp \
b/kwin/clients/oxygen/config/oxygendetectwidget.cpp index cc5a5d8..1162b74 100644
--- a/kwin/clients/oxygen/config/oxygendetectwidget.cpp
+++ b/kwin/clients/oxygen/config/oxygendetectwidget.cpp
@@ -81,18 +81,18 @@ namespace Oxygen
             return;
         }
 
-        _info = KWindowSystem::windowInfo( window, -1U, -1U );
-        if( !_info.valid())
+        _info.reset(new KWindowInfo( window, -1U, -1U ));
+        if( !_info->valid())
         {
             emit detectionDone( false );
             return;
         }
 
-        const QString wmClassClass( QString::fromUtf8( _info.windowClassClass() ) );
-        const QString wmClassName( QString::fromUtf8( _info.windowClassName() ) );
+        const QString wmClassClass( QString::fromUtf8( _info->windowClassClass() ) \
); +        const QString wmClassName( QString::fromUtf8( _info->windowClassName() ) \
);  
         windowClass->setText( QStringLiteral( "%1 (%2 %3)" ).arg( wmClassClass \
                ).arg( wmClassName ).arg( wmClassClass ) );
-        Ui::OxygenDetectWidget::windowTitle->setText( _info.name() );
+        Ui::OxygenDetectWidget::windowTitle->setText( _info->name() );
         emit detectionDone( exec() == QDialog::Accepted );
 
         return;
diff --git a/kwin/clients/oxygen/config/oxygendetectwidget.h \
b/kwin/clients/oxygen/config/oxygendetectwidget.h index 320708f..a718488 100644
--- a/kwin/clients/oxygen/config/oxygendetectwidget.h
+++ b/kwin/clients/oxygen/config/oxygendetectwidget.h
@@ -63,7 +63,7 @@ namespace Oxygen
 
         //! window information
         const KWindowInfo& windowInfo() const
-        { return _info; }
+        { return *(_info.data()); }
 
         //! exception type
         Configuration::EnumExceptionType exceptionType() const
@@ -99,7 +99,7 @@ namespace Oxygen
         QDialog* _grabber;
 
         //! current window information
-        KWindowInfo _info;
+        QScopedPointer<KWindowInfo> _info;
 
         //! wm state atom
         xcb_atom_t _wmStateAtom;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic