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

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Mon Jul 12 18:19:46 UTC 2021


 sfx2/source/control/unoctitm.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit a023a967978a334fd5016ab325864796def295cc
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Jul 12 16:47:51 2021 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Jul 12 20:19:10 2021 +0200

    sfx2: fix assert failure when deleting SfxOfficeDispatch on a thread
    
    Steps to reproduce the problem:
    
    1) Start soffice with "--accept=socket,host=localhost,port=9999;urp;StarOffice.ServiceManager"
    
    2) Run a java / uno example that registers a custom dispatch interceptor
    by calling registerDispatchProviderInterceptor().
    
    3) Open a Writer document, choose insert -> object -> ole object ->
    spreadsheet (i.e. Calc)
    
    Then this assertion failure is hit:
    
    tllo.dll!DbgTestSolarMutex() Line 96
            at C:\lo\master\tools\source\debug\debug.cxx(96)
    svllo.dll!SfxBroadcaster::RemoveListener(SfxListener & rListener) Line 104
            at C:\lo\master\svl\source\notify\SfxBroadcaster.cxx(104)
    svllo.dll!SfxListener::~SfxListener() Line 54
            at C:\lo\master\svl\source\notify\lstner.cxx(54)
    sfxlo.dll!SfxDispatchController_Impl::~SfxDispatchController_Impl() Line 367
            at C:\lo\master\sfx2\source\control\unoctitm.cxx(367)
    sfxlo.dll!SfxOfficeDispatch::~SfxOfficeDispatch() Line 192
            at C:\lo\master\sfx2\source\control\unoctitm.cxx(192)
    
    Given that SfxListener wants its caller to lock the solar mutex and
    SfxDispatchController_Impl inherits from SfxListener, lock the mutex in
    the SfxOfficeDispatch dtor and explicitly delete
    SfxDispatchController_Impl while the mutex is still locked.
    
    Change-Id: Ib4201ef7866aaadedf9dfa8bd581ebe7a3bcf29a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118769
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins

diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 58bdc6179008..0a98f806d708 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -185,6 +185,11 @@ SfxOfficeDispatch::~SfxOfficeDispatch()
     {
         // when dispatch object is released, destroy its connection to this object and destroy it
         pImpl->UnBindController();
+
+        // Ensure that SfxDispatchController_Impl is deleted while the solar mutex is locked, since
+        // that derives from SfxListener.
+        SolarMutexGuard aGuard;
+        pImpl.reset();
     }
 }
 


More information about the Libreoffice-commits mailing list