void OfficeConnection::tearDown() { if (process_ == nullptr) return;
if (context_.is()) {
css::uno::Reference< css::frame::XDesktop2 > desktop = css::frame::Desktop::create( context_ );
context_.clear(); try {
CPPUNIT_ASSERT(desktop->terminate());
desktop.clear();
} catch (css::lang::DisposedException &) {} // it appears that DisposedExceptions can already happen while // receiving the response of the terminate call
}
CPPUNIT_ASSERT_EQUAL(osl_Process_E_None, osl_joinProcess(process_));
oslProcessInfo info;
info.Size = sizeof info;
CPPUNIT_ASSERT_EQUAL(
osl_Process_E_None,
osl_getProcessInfo(process_, osl_Process_EXITCODE, &info));
CPPUNIT_ASSERT_EQUAL(oslProcessExitCode(0), info.Code);
osl_freeProcessHandle(process_);
process_ = nullptr; // guard against subsequent calls to isStillAlive
}
bool OfficeConnection::isStillAlive() const { if (process_ == nullptr) { // In case "soffice" argument starts with "connect:" we have no direct // control over the liveness of the soffice.bin process (would need to // directly monitor the bridge) so can only assume the best here: returntrue;
}
TimeValue delay = { 0, 0 }; // 0 sec
oslProcessError e = osl_joinProcessWithTimeout(process_, &delay);
CPPUNIT_ASSERT(e == osl_Process_E_None || e == osl_Process_E_TimedOut); return e == osl_Process_E_TimedOut;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.