From f64e55f0dc19a18475770c4fe9ca278aff346620 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 27 May 2019 15:38:37 +0200 Subject: [PATCH] [libcalamaresui] Use meaningful asserts - In debug mode, hitting assert(false) is meaningless, - In release mode, the assert is optimized out. - So assert the condition we're actually testing, for better messages. --- src/libcalamaresui/utils/ImageRegistry.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/libcalamaresui/utils/ImageRegistry.cpp b/src/libcalamaresui/utils/ImageRegistry.cpp index 442017048..96ea92bbb 100644 --- a/src/libcalamaresui/utils/ImageRegistry.cpp +++ b/src/libcalamaresui/utils/ImageRegistry.cpp @@ -61,9 +61,9 @@ ImageRegistry::cacheKey( const QSize& size, float opacity, QColor tint ) QPixmap ImageRegistry::pixmap( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode, float opacity, QColor tint ) { + Q_ASSERT( !(size.width() < 0 || size.height() < 0) ); if ( size.width() < 0 || size.height() < 0 ) { - Q_ASSERT( false ); return QPixmap(); } @@ -159,15 +159,9 @@ ImageRegistry::putInCache( const QString& image, const QSize& size, CalamaresUti if ( s_cache.contains( image ) ) { subcache = s_cache.value( image ); - if ( subcache.contains( mode ) ) { subsubcache = subcache.value( mode ); - -/* if ( subsubcache.contains( size.width() * size.height() ) ) - { - Q_ASSERT( false ); - }*/ } }