Fix cppcheck warnings

This commit is contained in:
Lars Toenning
2023-04-16 21:02:55 +02:00
parent ac04aa3a63
commit 7ef0e6e1eb
28 changed files with 45 additions and 53 deletions

View File

@@ -98,7 +98,6 @@ namespace BlackGui::Components
else
{
qFatal("Wrong sender");
// cppcheck-suppress duplicateBreak
return;
}

View File

@@ -62,7 +62,7 @@ namespace BlackGui
if (processEvents && sGui)
{
sGui->processEventsToRefreshGui();
if (!myself) { return -1; } // deleted in meantime (process events)
if (!myself) { return -1; } // cppcheck-suppress knownConditionTrueFalse // deleted in meantime (process events)
}
const int stopId = m_currentId++; // copy

View File

@@ -534,7 +534,11 @@ namespace BlackGui::Menus
}
Q_ASSERT_X(subMenu, Q_FUNC_INFO, "Could not create sub menu");
subMenu->setParent(parentMenu);
if (subMenu)
{
subMenu->setParent(parentMenu);
}
if (pathDepth > 0 && subMenu)
{
subMenus.insert(key, subMenu);

View File

@@ -75,7 +75,7 @@ namespace BlackGui::Views
const int c = m_model->update(container, sort);
// resize after real update according to mode
if (presizeThresholdReached)
if (presizeThresholdReached) // cppcheck-suppress knownConditionTrueFalse
{
// currently no furhter actions
}
@@ -83,7 +83,7 @@ namespace BlackGui::Views
{
this->resizeToContents(); // mode based resize
}
else if (presize && !presizeThresholdReached)
else if (presize && !presizeThresholdReached) // cppcheck-suppress knownConditionTrueFalse
{
// small amount of data not covered before
this->fullResizeToContents();