[Libreoffice-commits] core.git: Branch 'aoo/trunk' - javaunohelper/com

Damjan Jovanovic damjan at apache.org
Fri Sep 8 14:01:12 UTC 2017


 javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 2d382cef5450cf1593322184649257d3666cbbd8
Author: Damjan Jovanovic <damjan at apache.org>
Date:   Fri Sep 8 02:17:19 2017 +0000

    Fix a locking bug in our Java ComponentBase class, where after the transition
    
    to disposed, the relevant variables (bDisposed and bInDispose) are written to
    outside a synchronized block.
    
    The equivalent C++ implementation in main/cppuhelper/source/implbase.cxx,
    method WeakComponentImplHelperBase::dispose(), already does this.
    
    Patch by: me

diff --git a/javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java b/javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java
index 12e408fb09f1..2c2a3ed42c60 100644
--- a/javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java
+++ b/javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java
@@ -92,8 +92,11 @@ public class ComponentBase extends WeakBase implements XComponent
             {
                 // finally makes sure that the  flags are set even if a RuntimeException is thrown.
                 // That ensures that this function is only called once.
-                bDisposed= true;
-                bInDispose= false;
+                synchronized (this)
+                {
+                    bDisposed= true;
+                    bInDispose= false;
+                }
             }
         }
         else


More information about the Libreoffice-commits mailing list