You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by da...@apache.org on 2017/09/08 02:17:19 UTC

svn commit: r1807667 - /openoffice/trunk/main/javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java

Author: damjan
Date: Fri Sep  8 02:17:19 2017
New Revision: 1807667

URL: http://svn.apache.org/viewvc?rev=1807667&view=rev
Log:
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


Modified:
    openoffice/trunk/main/javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java

Modified: openoffice/trunk/main/javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java?rev=1807667&r1=1807666&r2=1807667&view=diff
==============================================================================
--- openoffice/trunk/main/javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java (original)
+++ openoffice/trunk/main/javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java Fri Sep  8 02:17:19 2017
@@ -92,8 +92,11 @@ public class ComponentBase extends WeakB
             {
                 // 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