From 5fff1e414a060c0619a97ad8d3f5665e3f5a4878 Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Fri, 9 Jan 2026 16:16:48 +0100 Subject: Use Q_ASSERT instead of Q_CHECK_PTR for plain checks of pointer value Q_CHECK_PTR (other than the name suggests) is intended only to check the success of memory allocations. Using it for any pointers instead can be misleading due to the "Out of memory" log printed in case of hits. --- src/dolphinviewcontainer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/dolphinviewcontainer.cpp') diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index f6fd01de2..fb83be453 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -284,10 +284,10 @@ DolphinView *DolphinViewContainer::view() void DolphinViewContainer::connectUrlNavigator(DolphinUrlNavigator *urlNavigator) { - Q_CHECK_PTR(urlNavigator); + Q_ASSERT(urlNavigator); Q_ASSERT(!m_urlNavigatorConnected); Q_ASSERT(m_urlNavigator.get() != urlNavigator); - Q_CHECK_PTR(m_view); + Q_ASSERT(m_view); urlNavigator->setLocationUrl(m_view->url()); urlNavigator->setShowHiddenFolders(m_view->hiddenFilesShown()); @@ -413,8 +413,8 @@ void DolphinViewContainer::setSelectionModeEnabled(bool enabled, KActionCollecti if (!wasEnabled) { return; // nothing to do here } - Q_CHECK_PTR(m_selectionModeTopBar); // there is no point in disabling selectionMode when it wasn't even enabled once. - Q_CHECK_PTR(m_selectionModeBottomBar); + Q_ASSERT(m_selectionModeTopBar); // there is no point in disabling selectionMode when it wasn't even enabled once. + Q_ASSERT(m_selectionModeBottomBar); m_selectionModeTopBar->setVisible(false, WithAnimation); m_selectionModeBottomBar->setVisible(false, WithAnimation); Q_EMIT selectionModeChanged(false); -- cgit v1.3