[kstyle] Implement application unpolish to delete ShadowHelper

Summary:
Another change mostly for KWin (Wayland compositor). KWin destroys it's
internal Wayland connection prior to the QStyle getting destroyed. As
the ShadowHelper initialized Wayland objects those would be destroyed
after the connection is destroyed. With latest Wayland library this
would cause a crash.

Thus unpolish is implemented in the style and deletes the ShadowHelper.
KWin can on tear down invoke the unpolish and thus make sure it doesn't
crash.

CCBUG: 372001

Reviewers: #plasma, broulik, hpereiradacosta

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D3240
wilder-pre-rebase
Martin Gräßlin 9 years ago
parent 088c767298
commit a0433d089a
  1. 15
      kstyle/breezestyle.cpp
  2. 7
      kstyle/breezestyle.h

@ -197,9 +197,24 @@ namespace Breeze
//______________________________________________________________
Style::~Style( void )
{
cleanup();
}
//______________________________________________________________
void Style::unpolish( QApplication* )
{
// NOTE: unpolish is not called in general on tear-down of Application
// only when a new QStyle is loaded by the QApplication unpolish is invoked
cleanup();
}
void Style::cleanup( void )
{
delete _shadowHelper;
_shadowHelper = nullptr;
delete _helper;
_helper = nullptr;
}
//______________________________________________________________

@ -92,7 +92,6 @@ namespace Breeze
//* needed to avoid warnings at compilation time
using ParentStyleClass::polish;
using ParentStyleClass::unpolish;
//* widget polishing
virtual void polish( QWidget* );
@ -100,6 +99,9 @@ namespace Breeze
//* widget unpolishing
virtual void unpolish( QWidget* );
//* application unpolishing
void unpolish( QApplication* ) override;
//* polish scrollarea
void polishScrollArea( QAbstractScrollArea* );
@ -471,6 +473,9 @@ namespace Breeze
private:
//* shared cleanup for unpolish and dtor
void cleanup();
//*@name scrollbar button types (for addLine and subLine )
//@{
ScrollBarButtonType _addLineButtons;

Loading…
Cancel
Save