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/dolphinmainwindow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/dolphinmainwindow.cpp') diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index baf94ef3e..018a6c95a 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -189,11 +189,11 @@ DolphinMainWindow::DolphinMainWindow() connect(m_actionHandler, &DolphinViewActionHandler::selectionModeChangeTriggered, this, &DolphinMainWindow::slotSetSelectionMode); QAction *newDirAction = actionCollection()->action(QStringLiteral("create_dir")); - Q_CHECK_PTR(newDirAction); + Q_ASSERT(newDirAction); m_newFileMenu->setNewFolderShortcutAction(newDirAction); QAction *newFileAction = actionCollection()->action(QStringLiteral("create_file")); - Q_CHECK_PTR(newFileAction); + Q_ASSERT(newFileAction); m_newFileMenu->setNewFileShortcutAction(newFileAction); m_remoteEncoding = new DolphinRemoteEncoding(this, m_actionHandler); @@ -271,7 +271,7 @@ DolphinMainWindow::~DolphinMainWindow() disconnect(QGuiApplication::clipboard(), &QClipboard::dataChanged, this, &DolphinMainWindow::updatePasteAction); // This fixes a crash in dolphinmainwindowtest where the connection below fires even though the KMainWindow destructor of this object is already running. - Q_CHECK_PTR(qobject_cast(m_placesPanel->parent())); + Q_ASSERT(qobject_cast(m_placesPanel->parent())); disconnect(static_cast(m_placesPanel->parent()), &DolphinDockWidget::visibilityChanged, this, -- cgit v1.3