From a24b90a21c4f2feb61630ca6a1684312556a6bc7 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Thu, 14 Apr 2016 14:55:44 +0300 Subject: Gui: use const (and const APIs) more For CoW types, prefer const methods to avoid needless detach()ing. Change-Id: I88d08d499e1be72c1f6d983fecdcee513df18aa2 Reviewed-by: Edward Welbourne --- src/gui/image/qimagepixmapcleanuphooks.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/gui/image/qimagepixmapcleanuphooks.cpp') diff --git a/src/gui/image/qimagepixmapcleanuphooks.cpp b/src/gui/image/qimagepixmapcleanuphooks.cpp index 10fa4303b2..f383e7a60e 100644 --- a/src/gui/image/qimagepixmapcleanuphooks.cpp +++ b/src/gui/image/qimagepixmapcleanuphooks.cpp @@ -84,38 +84,38 @@ void QImagePixmapCleanupHooks::removeImageHook(_qt_image_cleanup_hook_64 hook) void QImagePixmapCleanupHooks::executePlatformPixmapModificationHooks(QPlatformPixmap* pmd) { - QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks(); + const QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks(); // the global destructor for the pixmap and image hooks might have // been called already if the app is "leaking" global // pixmaps/images if (!h) return; - for (int i = 0; i < h->pixmapModificationHooks.count(); ++i) - h->pixmapModificationHooks[i](pmd); + for (auto hook : h->pixmapModificationHooks) + hook(pmd); } void QImagePixmapCleanupHooks::executePlatformPixmapDestructionHooks(QPlatformPixmap* pmd) { - QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks(); + const QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks(); // the global destructor for the pixmap and image hooks might have // been called already if the app is "leaking" global // pixmaps/images if (!h) return; - for (int i = 0; i < h->pixmapDestructionHooks.count(); ++i) - h->pixmapDestructionHooks[i](pmd); + for (auto hook : h->pixmapDestructionHooks) + hook(pmd); } void QImagePixmapCleanupHooks::executeImageHooks(qint64 key) { - QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks(); + const QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks(); // the global destructor for the pixmap and image hooks might have // been called already if the app is "leaking" global // pixmaps/images if (!h) return; - for (int i = 0; i < h->imageHooks.count(); ++i) - h->imageHooks[i](key); + for (auto hook : h->imageHooks) + hook(key); } -- cgit v1.2.3