Kaydet (Commit) e19cdeaf authored tarafından Michael Stahl's avatar Michael Stahl

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
üst 5e223be2
...@@ -24,6 +24,7 @@ import com.sun.star.awt.Point; ...@@ -24,6 +24,7 @@ import com.sun.star.awt.Point;
import com.sun.star.awt.Size; import com.sun.star.awt.Size;
import com.sun.star.awt.XControl; import com.sun.star.awt.XControl;
import com.sun.star.awt.XControlModel; import com.sun.star.awt.XControlModel;
import com.sun.star.awt.XToolkitExperimental;
import com.sun.star.beans.NamedValue; import com.sun.star.beans.NamedValue;
import com.sun.star.beans.XPropertySet; import com.sun.star.beans.XPropertySet;
import com.sun.star.container.NoSuchElementException; import com.sun.star.container.NoSuchElementException;
...@@ -182,6 +183,10 @@ public class UndoManager ...@@ -182,6 +183,10 @@ public class UndoManager
// switch the doc's view to form alive mode (so the button will actually work) // switch the doc's view to form alive mode (so the button will actually work)
m_currentDocument.getCurrentView().dispatch( ".uno:SwitchControlDesignMode" ); m_currentDocument.getCurrentView().dispatch( ".uno:SwitchControlDesignMode" );
XToolkitExperimental xToolkit = UnoRuntime.queryInterface(
XToolkitExperimental.class,
getORB().createInstance("com.sun.star.awt.Toolkit"));
xToolkit.processEventsToIdle();
// click the button // click the button
m_callbackCalled = false; m_callbackCalled = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment