boolean desktopTerminated = true;
if (process != null) {
if (context != null) {
XMultiComponentFactory factory = context.getServiceManager();
assertNotNull(factory);
XDesktop desktop = UnoRuntime.queryInterface(
XDesktop.class,
factory.createInstanceWithContext(
"com.sun.star.frame.Desktop", context));
context = null;
try {
desktopTerminated = desktop.terminate();
} catch (DisposedException e) {}
// it appears that DisposedExceptions can already happen
// while receiving the response of the terminate call
desktop = null;
} else {