From cb2b2541dae76a9c6819402999acee68f1a1e9c6 Mon Sep 17 00:00:00 2001 From: Katja Marttila Date: Fri, 5 Mar 2021 10:42:28 +0200 Subject: Cppcheck: Misc fixes Change-Id: I77acdecaf5660f2d7aa723c56d53a97e5687a8b8 Reviewed-by: Arttu Tarkiainen --- src/libs/installer/componentselectionpage_p.cpp | 3 +-- src/libs/installer/keepaliveobject.cpp | 7 ++++++- src/libs/installer/loggingutils.cpp | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src/libs/installer') diff --git a/src/libs/installer/componentselectionpage_p.cpp b/src/libs/installer/componentselectionpage_p.cpp index a9f4ba134..c333195c1 100644 --- a/src/libs/installer/componentselectionpage_p.cpp +++ b/src/libs/installer/componentselectionpage_p.cpp @@ -399,10 +399,9 @@ void ComponentSelectionPagePrivate::fetchRepositoryCategories() { updateWidgetVisibility(true); - QCheckBox *checkbox; QList checkboxes = m_categoryGroupBox->findChildren(); for (int i = 0; i < checkboxes.count(); i++) { - checkbox = checkboxes.at(i); + QCheckBox *checkbox = checkboxes.at(i); enableRepositoryCategory(checkbox->objectName(), checkbox->isChecked()); } diff --git a/src/libs/installer/keepaliveobject.cpp b/src/libs/installer/keepaliveobject.cpp index 94e91efd8..18ec9743a 100644 --- a/src/libs/installer/keepaliveobject.cpp +++ b/src/libs/installer/keepaliveobject.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -48,7 +48,12 @@ KeepAliveObject::KeepAliveObject() void KeepAliveObject::start() { + if (m_timer) + delete m_timer; m_timer = new QTimer(this); + + if (m_socket) + delete m_socket; m_socket = new QLocalSocket(this); connect(m_timer, &QTimer::timeout, [this]() { diff --git a/src/libs/installer/loggingutils.cpp b/src/libs/installer/loggingutils.cpp index 0ebba10db..45f7aab1b 100644 --- a/src/libs/installer/loggingutils.cpp +++ b/src/libs/installer/loggingutils.cpp @@ -259,7 +259,7 @@ void LoggingHandler::printComponentInfo(const QList components) con QDomElement root = doc.createElement(QLatin1String("updates")); doc.appendChild(root); - foreach (Component *component, components) { + foreach (const Component *component, components) { QDomElement update = doc.createElement(QLatin1String("update")); update.setAttribute(QLatin1String("name"), component->value(scDisplayName)); update.setAttribute(QLatin1String("version"), component->value(scVersion)); -- cgit v1.2.3