I have been trying to figure this out for hours.
I am opening a pywebview window in LibreOffice via Python
It has to run on the main thread.
I can start the the webview no problem from the main menu in my extension no problem.
I can also start form the custom popup menu in Calc no problem.
The issue is when the webview is opened from the popup it will crash LibreOffice when it is closed; However, when started from the main menu the webview can be closed wiithout issue.
I even tired to hide the webview window and close it when LibreOffice Terminates via a XTerminateListener and still crashes.
I tried closing on a different thread same issue. Then I tired a time delay on the thread, same issue.
This is the node that places the menu item on my LibrePy
main menu in the extension.
<node oor:name="m018" oor:op="replace">
<prop oor:name="URL" oor:type="xs:string">
<value>vnd.sun.star.job:service=com.github.amourspirit.extensions.librepythonista.py_edit_sheet_job</value>
</prop>
<prop oor:name="Title" oor:type="xs:string">
<value>Web Veiw 2</value>
</prop>
<prop oor:name="Target" oor:type="xs:string">
<value>_self</value>
</prop>
</node>
In Python I am I am creating the instance via when the popup menu is clicked.
I am creating the service in code using XMultiComponentFactory.createInstanceWithContext()
job = factory.createInstanceWithContext("com.github.amourspirit.extensions.librepythonista.py_edit_sheet_job", ctx)
job.execute(())