From 1963dc64554a8b64c229ddd72bc615f3e736731a Mon Sep 17 00:00:00 2001 From: Damjan Jovanovic Date: Fri, 8 Sep 2017 02:17:19 +0000 Subject: 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 Reviewed-by: Stephan Bergmann --- javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'javaunohelper') 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 -- cgit