Apache OpenOffice (AOO) Bugzilla – Issue 109658
oo crashes i macro is called from startcenter twice
Last modified: 2017-05-20 11:35:06 UTC
oo crashes if one starts a basic macro the *second* time from a menu entry directly from oo startcenter. the extension demo uses a java protocol handler: [...] final XScript xScript = xScriptProvider.getScript(script); final Object ret = xScript.invoke(aArgs, null, null); please have a look at the attachment's. steps to reproduce: - install "myprotocolhandler.zip" extension - create the test macro in "My Macros - Standard - Module1": Sub Test MsgBox "Hello World!" End Sub - close and restart oo - select "Makro Test" from menu "Test Dispatch" from Calc/Writer -> first time: Hello World -> second time: Hello World -> ... -> no problems at all - now select "Test Dispatch - Makro Test" directly from OO StartCenter -> first time: Hello World -> second time: --------------------------- Microsoft Visual C++ Runtime Library --------------------------- Runtime Error! Program: C:\Program Files\OpenOffice.org\program\soffice.bin This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. btw: no problems if one select the "Java Test" from StartCenter
Created attachment 68049 [details] example extension - ready to install
Created attachment 68050 [details] source code - eclipse project
Created attachment 68051 [details] error report oo300m72
can confirm with DEV300m72 on Win Xp - see attached "c35c_appcompat.xml"
can confirm
.
Created attachment 72006 [details] gdb backtrace
the uncaught RuntimeException tells: unsatisfied query for interface of type com.sun.star.script.provider.XScriptProvider! java stack trace: at com.sun.star.bridges.jni_uno.JNI_proxy.dispatch_call(Native Method) at com.sun.star.bridges.jni_uno.JNI_proxy.invoke(JNI_proxy.java:175) at $Proxy16.createScriptProvider(Unknown Source) at org.test.ExecuteBasicScript.executeScript(ExecuteBasicScript.java:38) at org.test.OOProtocolHandler.dispatch(OOProtocolHandler.java:100) at com.sun.star.bridges.jni_uno.JNI_proxy.dispatch_call(Native Method) at com.sun.star.bridges.jni_uno.JNI_proxy.invoke(JNI_proxy.java:175) at $Proxy16.createScriptProvider(Unknown Source) at org.test.ExecuteBasicScript.executeScript(ExecuteBasicScript.java:38) at org.test.OOProtocolHandler.dispatch(OOProtocolHandler.java:100) in ExecuteBasicScript.executeScript() final XScriptProvider xScriptProvider = xScriptProviderFactory.createScriptProvider(getModel()); the StartModule has no model! I wander how it even works the first time and crashes the second one?
Created attachment 72008 [details] sample component not crashing the office
arielch->brinzing: try the sample component (a NB Project in ProtocolHandlerExample.tar.gz). You can simply avoid the crash by catching the exception thrown in the bridge. public Object executeScript(final String script, final Object[] aArgs) { try { //... } catch (final IllegalArgumentException e) { System.err.println(e.getMessage()); } catch (final ScriptFrameworkErrorException e) { System.err.println(e.getMessage()); } catch (final InvocationTargetException e) { System.err.println(e.getMessage()); } catch (final NullPointerException e) { System.err.println(e.getMessage()); } catch (final com.sun.star.uno.Exception e) { System.err.println(e.getMessage()); } catch (final java.lang.Exception e) { System.err.println(e.getMessage()); } return null; } I still do not see why it works the first time and crashes the second... may be because you use getCurrentComponent() which is always a bad idea. Your ProtocolHandler gets an XFrame, pass it to your working class. On the other side, the StartModule has no model, and its controller does not implement XScriptInvocationContext.
i tried with your example, and can confirm: oo does not crash anymore. but the basic script will be executed only the first time. so i think we still have a bug...
now changed source code from: xScriptProviderFactory.createScriptProvider(xModel); to xScriptProviderFactory.createScriptProvider(""); (see http://www.oooforum.org/forum/viewtopic.phtml?t=23310 for example) and it works ... but code snippet tells to use "document" as parameter: http://codesnippets.services.openoffice.org/Office/Office.HowToCallJavaProgramUsingScriptingFramework.snip
Yes, it is not clear what is expected under that Any. Looking at the com.sun.star.script.provider.MasterScriptProviderFactory implementation: http://svn.services.openoffice.org/opengrok/xref/DEV300_m88/scripting/source/provider/MasterScriptProviderFactory.cxx#63 it calls ActiveMSPList::getMSPFromAnyContext() http://svn.services.openoffice.org/opengrok/xref/DEV300_m88/scripting/source/provider/ActiveMSPList.cxx#82 There you see that it can be a string, or an XModel, or something else implementing XScriptInvocationContext. Not sure where the empty string "" ends up... but the impl. seems to expect a "vnd.sun.star.tdoc", see http://svn.services.openoffice.org/opengrok/xref/DEV300_m88/scripting/source/provider/ActiveMSPList.cxx#161 Anyway, yes, there is an issue, in the fact that the office should not crash if you do not catch an exception thrown in the bridge.
Reset assigne to the default "issues@openoffice.apache.org".