[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 ;-)
This commit is contained in:
Martin Gräßlin 2014-02-01 08:58:26 +01:00
parent 66375ad741
commit 73e6d9162d
2 changed files with 7 additions and 7 deletions

View file

@ -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;

View file

@ -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;