summaryrefslogtreecommitdiff
path: root/javaunohelper/com
diff options
context:
space:
mode:
authorDamjan Jovanovic <damjan@apache.org>2017-09-08 02:17:19 +0000
committerStephan Bergmann <sbergman@redhat.com>2017-09-13 10:16:18 +0200
commit1963dc64554a8b64c229ddd72bc615f3e736731a (patch)
tree00c842d03b79ebaecdb447ae27b193c1e47160ec /javaunohelper/com
parent5c0bb1088a678d36309866c4eee43e58901f6b7b (diff)
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 (cherry picked from commit 2d382cef5450cf1593322184649257d3666cbbd8) Change-Id: I6c3e2ef78bc3c945245fe9fb7b6b713eb83710be Reviewed-on: https://gerrit.libreoffice.org/42189 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'javaunohelper/com')
-rw-r--r--javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java b/javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java
index 783c1d0cfcc2..d886ef7020d5 100644
--- a/javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java
+++ b/javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java
@@ -87,8 +87,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