summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2017-01-12 22:09:27 +0100
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2017-01-17 00:05:01 +0000
commitf5811d12bb7b11f20f159332a73db8ff5e4f9a8b (patch)
tree7699dd654a93e778a0a68c72ed2be7d0f12d679f /sfx2
parent285194c1cceb07868eca9415b67a9b1aaae1ba56 (diff)
sfx2: fix race in JunitTest UndoManager.checkBrokenScripts()
1) checkBrokenScripts(complex.sfx2.UndoManager) java.lang.NullPointerException at complex.sfx2.UndoManager.impl_clickButton(UndoManager.java:432) at complex.sfx2.UndoManager.checkBrokenScripts(UndoManager.java:188) impl_clickButton() gets the wrong accessible object and throws. The .uno:SwitchControlDesignMode is dispatched async, so make sure it's processesed before trying to click the button. See UnoControl::getAccessibleContext() "in design mode, use a fallback". This was running in "rr record --chaos". Change-Id: Iee9f25c2fff56d32e6b579b5d44ee6df9870fd8b (cherry picked from commit e19cdeaf7ddbcf39da47d9685d8e79e775dde7f4) Reviewed-on: https://gerrit.libreoffice.org/33171 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/qa/complex/sfx2/UndoManager.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/sfx2/qa/complex/sfx2/UndoManager.java b/sfx2/qa/complex/sfx2/UndoManager.java
index ad82ca4c9db8..a8e6bcdba861 100644
--- a/sfx2/qa/complex/sfx2/UndoManager.java
+++ b/sfx2/qa/complex/sfx2/UndoManager.java
@@ -24,6 +24,7 @@ import com.sun.star.awt.Point;
import com.sun.star.awt.Size;
import com.sun.star.awt.XControl;
import com.sun.star.awt.XControlModel;
+import com.sun.star.awt.XToolkitExperimental;
import com.sun.star.beans.NamedValue;
import com.sun.star.beans.XPropertySet;
import com.sun.star.container.NoSuchElementException;
@@ -182,6 +183,10 @@ public class UndoManager
// switch the doc's view to form alive mode (so the button will actually work)
m_currentDocument.getCurrentView().dispatch( ".uno:SwitchControlDesignMode" );
+ XToolkitExperimental xToolkit = UnoRuntime.queryInterface(
+ XToolkitExperimental.class,
+ getORB().createInstance("com.sun.star.awt.Toolkit"));
+ xToolkit.processEventsToIdle();
// click the button
m_callbackCalled = false;