From: Manuel Nickschas Date: Wed, 5 Sep 2018 18:53:24 +0000 (+0200) Subject: clang-tidy: Avoid another warning about potential memory leak X-Git-Tag: 0.13-rc2~39 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=b40672ab5c48b577b31371c159e60d330fdd7ce5 clang-tidy: Avoid another warning about potential memory leak This is a false positive (since the newly created QFormLayout takes a widget as its parent), however some slight rearrangement of code shuts up clang-tidy without resorting to NOLINT. --- diff --git a/src/qtui/coreconfigwizard.cpp b/src/qtui/coreconfigwizard.cpp index 471837bf..8225fe47 100644 --- a/src/qtui/coreconfigwizard.cpp +++ b/src/qtui/coreconfigwizard.cpp @@ -54,10 +54,11 @@ QGroupBox *createFieldBox(const QString &title, const std::vector &fi // provide specialized config widgets for those (which may be a good idea anyway, e.g. if we // think about client-side translations...) - QGroupBox *fieldBox = new QGroupBox; + auto *fieldBox = new QGroupBox; fieldBox->setTitle(title); + auto *formLayout = new QFormLayout; + fieldBox->setLayout(formLayout); - QFormLayout *formLayout = new QFormLayout(fieldBox); for (auto &&fieldInfo : fieldInfos) { QWidget *widget {nullptr}; switch (std::get<2>(fieldInfo).type()) {