summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-08-17 14:23:23 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-08-17 20:09:45 +0200
commit8eafcd47ed9a8556ba28ed2e99e800c36a86d661 (patch)
tree19306cd04b23e07d83ee8ea703548c6540a42c84 /sc
parentf74e50d705ed2c8ae3a42ab8bddd4b57031a5d8e (diff)
cid#1616506 Resource leak
and fixup headers Change-Id: I0a3e5f71f1dbfa9c1119c5b4bef634f27797927d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171972 Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/condformat/condformateasydlg.cxx26
1 files changed, 19 insertions, 7 deletions
diff --git a/sc/source/ui/condformat/condformateasydlg.cxx b/sc/source/ui/condformat/condformateasydlg.cxx
index 12ee8dc6f618..06876a6d4427 100644
--- a/sc/source/ui/condformat/condformateasydlg.cxx
+++ b/sc/source/ui/condformat/condformateasydlg.cxx
@@ -1,3 +1,12 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
#include <docfunc.hxx>
#include <condformateasydlg.hxx>
#include <stlpool.hxx>
@@ -352,23 +361,24 @@ IMPL_LINK(ConditionalFormatEasyDialog, ButtonPressed, weld::Button&, rButton, vo
break;
}
- ScFormatEntry* pEntry;
+ std::unique_ptr<ScFormatEntry> xEntry;
if (meMode < ScConditionMode::Formula)
{
- pEntry = new ScCondFormatEntry(meMode, sExpression1, sExpression2, *mpDocument,
- maPosition, mxStyles->get_active_text());
+ xEntry.reset(new ScCondFormatEntry(meMode, sExpression1, sExpression2, *mpDocument,
+ maPosition, mxStyles->get_active_text()));
}
else if (meMode >= ScConditionMode::Today && meMode < ScConditionMode::NONE)
{
ScCondDateFormatEntry entry(mpDocument);
entry.SetDateType(GetScCondFormatDateType(meMode));
entry.SetStyleName(mxStyles->get_active_text());
- pEntry = new ScCondDateFormatEntry(mpDocument, entry);
+ xEntry.reset(new ScCondDateFormatEntry(mpDocument, entry));
}
else if (meMode == ScConditionMode::Formula)
{
- pEntry = new ScCondFormatEntry(ScConditionMode::Direct, msFormula, OUString(),
- *mpDocument, maPosition, mxStyles->get_active_text());
+ xEntry.reset(new ScCondFormatEntry(ScConditionMode::Direct, msFormula, OUString(),
+ *mpDocument, maPosition,
+ mxStyles->get_active_text()));
}
else
{
@@ -382,7 +392,7 @@ IMPL_LINK(ConditionalFormatEasyDialog, ButtonPressed, weld::Button&, rButton, vo
mpViewData->GetDocument().GetAddressConvention(), maPosition.Tab());
if ((nFlags & ScRefFlags::VALID) && !aRange.empty())
{
- pFormat->AddEntry(pEntry);
+ pFormat->AddEntry(xEntry.release());
pFormat->SetRange(aRange);
auto& rRangeList = pFormat->GetRange();
mpViewData->GetDocShell()->GetDocFunc().ReplaceConditionalFormat(
@@ -400,3 +410,5 @@ IMPL_LINK_NOARG(ConditionalFormatEasyDialog, StyleSelectHdl, weld::ComboBox&, vo
}
} // namespace sc
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */