[Libreoffice-commits] core.git: 2 commits - sc/source xmlhelp/Library_ucpchelp1.mk

Michael Stahl mstahl at redhat.com
Wed Sep 30 02:05:21 PDT 2015


 sc/source/ui/vba/vbaeventshelper.cxx |   13 ++++++++++---
 xmlhelp/Library_ucpchelp1.mk         |    6 ------
 2 files changed, 10 insertions(+), 9 deletions(-)

New commits:
commit 520514cfe6a99f68b9e1d458fae20026f1a8f66b
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Sep 30 10:31:23 2015 +0200

    sc: fix crash in ScVbaEventListener::processWindowResizeEvent()
    
    This was crashing in CppunitTest_sc_macros_test on Windows with
    --enable-mergelibs (release build), because the first invocation of
    processWindowResizeEvent() deleted the vcl::Window, and the
    maControllers.count(pWindow) test creates a VclPtr for it, so ends up
    with a double-free.
    
    TODO: is processWindowResizeEvent() supposed to be idempotent?
    It would be possible to detect that there is already an event posted by
    checking m_PostedWindows in postWindowResizeEvent().
    
    Change-Id: I7b72f2baf21bb8223e9fe4bd929d826217b920e5

diff --git a/sc/source/ui/vba/vbaeventshelper.cxx b/sc/source/ui/vba/vbaeventshelper.cxx
index a083c22..294a6c2 100644
--- a/sc/source/ui/vba/vbaeventshelper.cxx
+++ b/sc/source/ui/vba/vbaeventshelper.cxx
@@ -170,7 +170,7 @@ private:
     uno::Reference< frame::XModel > mxModel;
     ScDocShell*         mpDocShell;
     WindowControllerMap maControllers;          /// Maps VCL top windows to their controllers.
-    std::set< VclPtr<vcl::Window> > maPostedWindows; /// Keeps processWindowResizeEvent windows from being deleted between postWindowResizeEvent and processWindowResizeEvent
+    std::multiset< VclPtr<vcl::Window> > m_PostedWindows; /// Keeps processWindowResizeEvent windows from being deleted between postWindowResizeEvent and processWindowResizeEvent
     VclPtr<vcl::Window>            mpActiveWindow; /// Currently activated window, to prevent multiple (de)activation.
     bool                mbWindowResized;        /// True = window resize system event processed.
     bool                mbBorderChanged;        /// True = borders changed system event processed.
@@ -472,7 +472,7 @@ void ScVbaEventListener::postWindowResizeEvent( vcl::Window* pWindow )
     {
         mbWindowResized = mbBorderChanged = false;
         acquire();  // ensure we don't get deleted before the timer fires
-        maPostedWindows.insert(pWindow);
+        m_PostedWindows.insert(pWindow);
         Application::PostUserEvent( LINK( this, ScVbaEventListener, processWindowResizeEvent ), pWindow );
     }
 }
@@ -506,7 +506,14 @@ IMPL_LINK_TYPED( ScVbaEventListener, processWindowResizeEvent, void*, p, void )
             }
         }
     }
-    maPostedWindows.erase(pWindow);
+    {
+        // note: there may be multiple processWindowResizeEvent outstanding
+        // for pWindow, so it may have been added to m_PostedWindows multiple
+        // times - so this must delete exactly one of these elements!
+        auto const iter(m_PostedWindows.find(pWindow));
+        assert(iter != m_PostedWindows.end());
+        m_PostedWindows.erase(iter);
+    }
     release();
 }
 
commit 3649c0c21a3b61950848ce32910f3d00c4908194
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Sep 29 22:16:24 2015 +0200

    xmlhelp: -GR is added by default in com_MSC_defs.mk
    
    Change-Id: Ibd2c851cef3c26a37c05b894e7487e460470fecf

diff --git a/xmlhelp/Library_ucpchelp1.mk b/xmlhelp/Library_ucpchelp1.mk
index 0ea5d1b..8109e5e 100644
--- a/xmlhelp/Library_ucpchelp1.mk
+++ b/xmlhelp/Library_ucpchelp1.mk
@@ -11,12 +11,6 @@ $(eval $(call gb_Library_Library,ucpchelp1))
 
 $(eval $(call gb_Library_set_componentfile,ucpchelp1,xmlhelp/util/ucpchelp1))
 
-ifeq ($(OS)$(COM),WNTMSC)
-$(eval $(call gb_Library_add_cxxflags,ucpchelp1,\
-	-GR \
-))
-endif
-
 $(eval $(call gb_Library_set_include,ucpchelp1,\
 	-I$(SRCDIR)/xmlhelp/source/cxxhelp/inc \
 	$$(INCLUDE) \


More information about the Libreoffice-commits mailing list