summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-11-03 09:14:18 +0100
committerAndras Timar <andras.timar@collabora.com>2023-06-30 00:46:10 +0200
commit67a663626d6a45acfad686f46686c356336f443a (patch)
treea4129efa14bb1ce6a009a25b0a2bd545b698192d
parentsc: filter: oox: fix crash delete ScDatabarFormatData (diff)
downloadcore-67a663626d6a45acfad686f46686c356336f443a.tar.gz
core-67a663626d6a45acfad686f46686c356336f443a.zip
-Werror=dangling-reference
In <https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=d2249cd9adf5ae638577139177a50f7e62d8abd9> "c++: Implement -Wdangling-reference [PR106393]" grew a new warning, included in -Wall, and based on some more-or-less shaky heuristics, that warns about "possibly dangling reference to a temporary". It produces quite a number of false positives, but for these uses of SfxItemSet::Get it does look plausible that the returned item references could, at least in theory, point at data that is destroyed along with the temporary SfxItemSet. Change-Id: I11afc4512db488f73170c6cfa706e9e094209550 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142217 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com> (cherry picked from commit e0121b2478526d803681d57d59af0cbf9cf602b4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153583 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r--editeng/source/accessibility/AccessibleEditableTextPara.cxx3
-rw-r--r--sc/source/ui/drawfunc/drtxtob.cxx3
-rw-r--r--sc/source/ui/view/editsh.cxx3
-rw-r--r--sd/qa/unit/tiledrendering/tiledrendering.cxx8
4 files changed, 9 insertions, 8 deletions
diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
index e547767911e2..d6df9f91cabc 100644
--- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx
+++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
@@ -1525,8 +1525,7 @@ namespace accessibility
// NumberingLevel
if (rRes.Name == "NumberingLevel")
{
- const SvxNumBulletItem& rNumBullet = rCacheTF.GetParaAttribs(GetParagraphIndex()).Get(EE_PARA_NUMBULLET);
- if(rNumBullet.GetNumRule().GetLevelCount()==0)
+ if(rCacheTF.GetParaAttribs(GetParagraphIndex()).Get(EE_PARA_NUMBULLET).GetNumRule().GetLevelCount()==0)
{
rRes.Value <<= sal_Int16(-1);
rRes.Handle = -1;
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index 9303380ca494..6d26bdcc6a4c 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -204,7 +204,8 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq )
case SID_CHARMAP:
{
- const SvxFontItem& rItem = pOutView->GetAttribs().Get(EE_CHAR_FONTINFO);
+ auto const attribs = pOutView->GetAttribs();
+ const SvxFontItem& rItem = attribs.Get(EE_CHAR_FONTINFO);
OUString aString;
std::shared_ptr<SvxFontItem> aNewItem(std::make_shared<SvxFontItem>(EE_CHAR_FONTINFO));
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index ba0abdc433c4..331b343950f6 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -382,8 +382,9 @@ void ScEditShell::Execute( SfxRequest& rReq )
sal_uInt16 nFontWhich = ( nScript == SvtScriptType::ASIAN ) ? EE_CHAR_FONTINFO_CJK :
( ( nScript == SvtScriptType::COMPLEX ) ? EE_CHAR_FONTINFO_CTL :
EE_CHAR_FONTINFO );
+ auto const attribs = pTableView->GetAttribs();
const SvxFontItem& rItem = static_cast<const SvxFontItem&>(
- pTableView->GetAttribs().Get(nFontWhich));
+ attribs.Get(nFontWhich));
OUString aString;
std::shared_ptr<SvxFontItem> aNewItem(std::make_shared<SvxFontItem>(EE_CHAR_FONTINFO));
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 3a449e76004d..ab2897b08441 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -1502,8 +1502,8 @@ void SdTiledRenderingTest::testTdf102223()
EditView& rEditView = pView->GetTextEditOutlinerView()->GetEditView();
rEditView.SetSelection(ESelection(0, 0, 0, 3)); // start para, start char, end para, end char.
CPPUNIT_ASSERT_EQUAL(OUString("Red"), rEditView.GetSelected());
- const SvxFontHeightItem& rItem = rEditView.GetAttribs().Get(EE_CHAR_FONTHEIGHT);
- CPPUNIT_ASSERT_EQUAL(int(1411), static_cast<int>(rItem.GetHeight()));
+ CPPUNIT_ASSERT_EQUAL(
+ int(1411), static_cast<int>(rEditView.GetAttribs().Get(EE_CHAR_FONTHEIGHT).GetHeight()));
// cut contents of cell
uno::Sequence<beans::PropertyValue> aArgs;
@@ -1514,8 +1514,8 @@ void SdTiledRenderingTest::testTdf102223()
CPPUNIT_ASSERT(pView->GetTextEditObject());
EditView& rEditView2 = pView->GetTextEditOutlinerView()->GetEditView();
rEditView2.SetSelection(ESelection(0, 0, 0, 1)); // start para, start char, end para, end char.
- const SvxFontHeightItem& rItem2 = rEditView2.GetAttribs().Get(EE_CHAR_FONTHEIGHT);
- CPPUNIT_ASSERT_EQUAL(int(1411), static_cast<int>(rItem2.GetHeight()));
+ CPPUNIT_ASSERT_EQUAL(
+ int(1411), static_cast<int>(rEditView2.GetAttribs().Get(EE_CHAR_FONTHEIGHT).GetHeight()));
}
void SdTiledRenderingTest::testTdf118354()