summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-01-28 09:08:18 +0100
committerMiklos Vajna <vmiklos@collabora.com>2019-01-28 11:47:31 +0100
commit525a5ea36310168c810dad6a8e764bf2ad2afce0 (patch)
treea592f885c95b5e716c44f2975474c5ad86c4e067
parent906b505940f6330d2336164f341e338ff4b9b9ee (diff)
sw: avoid wrong and unnecessary downcast in SwDrawView::DeleteMarked()
/sw/source/core/draw/dview.cxx:967:39: runtime error: downcast of address 0x6060006d1cc0 which does not point to an object of type 'SwDrawContact' 0x6060006d1cc0: note: object is of type 'SwFlyDrawContact' 1d 02 00 2e b0 3e 06 87 15 7f 00 00 18 3f 06 87 15 7f 00 00 50 1c 28 00 50 61 00 00 00 00 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'SwFlyDrawContact' #0 0x7f157de946d8 in SwDrawView::DeleteMarked() /sw/source/core/draw/dview.cxx:967:39 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /sw/source/core/draw/dview.cxx:967:39 in When executing testPasteListener in CppunitTest_sw_unowriter since commit 2a054445f09e8ba66e7cfb9f1d598554b555772d (sw paste listener: expose pasted images as well, 2019-01-24), though that code was added much earlier in commit 33141f999b22ce10cdbfbd76081fff211c4b5067 (SwDrawView::DeleteMarked: delete textbox of shape as well, 2014-06-23), just no testcase invoked it. Change-Id: I22a384ab7cc4b3eb00198b28de294896c2d1e3bb Reviewed-on: https://gerrit.libreoffice.org/66986 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
-rw-r--r--sw/source/core/draw/dview.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx
index 70436dd66f2e..91a3febb660a 100644
--- a/sw/source/core/draw/dview.cxx
+++ b/sw/source/core/draw/dview.cxx
@@ -964,8 +964,8 @@ void SwDrawView::DeleteMarked()
for (size_t i = 0; i < rMarkList.GetMarkCount(); ++i)
{
SdrObject *pObject = rMarkList.GetMark(i)->GetMarkedSdrObj();
- SwDrawContact* pDrawContact = static_cast<SwDrawContact*>(GetUserCall(pObject));
- SwFrameFormat* pFormat = pDrawContact->GetFormat();
+ SwContact* pContact = GetUserCall(pObject);
+ SwFrameFormat* pFormat = pContact->GetFormat();
if (SwFrameFormat* pTextBox = SwTextBoxHelper::getOtherTextBoxFormat(pFormat, RES_DRAWFRMFMT))
aTextBoxesToDelete.push_back(pTextBox);
}