[Libreoffice-commits] core.git: sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Jan 28 10:47:51 UTC 2019


 sw/source/core/draw/dview.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 525a5ea36310168c810dad6a8e764bf2ad2afce0
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Jan 28 09:08:18 2019 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Jan 28 11:47:31 2019 +0100

    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 at collabora.com>
    Tested-by: Jenkins

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);
     }


More information about the Libreoffice-commits mailing list