summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index c20639d20e..7b270d9241 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -118,14 +118,13 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(NotificationReceiver);
- (void)scrollBarStyleDidChange:(NSNotification *)notification
{
Q_UNUSED(notification);
+
+ // purge destroyed scroll bars:
+ QMacStylePrivate::scrollBars.removeAll(QPointer<QObject>());
+
QEvent event(QEvent::StyleChange);
- QMutableVectorIterator<QPointer<QObject> > it(QMacStylePrivate::scrollBars);
- while (it.hasNext()) {
- if (!it.next())
- it.remove();
- else
- QCoreApplication::sendEvent(it.value(), &event);
- }
+ for (const auto &o : QMacStylePrivate::scrollBars)
+ QCoreApplication::sendEvent(o, &event);
}
@end