diff --git a/kstyle/breezestyle.h b/kstyle/breezestyle.h --- a/kstyle/breezestyle.h +++ b/kstyle/breezestyle.h @@ -92,14 +92,16 @@ //* needed to avoid warnings at compilation time using ParentStyleClass::polish; - using ParentStyleClass::unpolish; //* widget polishing virtual void polish( QWidget* ); //* widget unpolishing virtual void unpolish( QWidget* ); + //* application unpolishing + void unpolish( QApplication* ) override; + //* polish scrollarea void polishScrollArea( QAbstractScrollArea* ); @@ -471,6 +473,9 @@ private: + //* shared cleanup for unpolish and dtor + void cleanup(); + //*@name scrollbar button types (for addLine and subLine ) //@{ ScrollBarButtonType _addLineButtons; diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp --- a/kstyle/breezestyle.cpp +++ b/kstyle/breezestyle.cpp @@ -198,8 +198,23 @@ //______________________________________________________________ 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; } //______________________________________________________________