COM-110: Catch engine session in adapter destructor so it can be destroyed gracefully
1.1 --- a/CpEpEngine.h Fri Feb 07 08:28:05 2020 +0100
1.2 +++ b/CpEpEngine.h Mon Mar 02 12:13:36 2020 +0100
1.3 @@ -49,7 +49,17 @@
1.4 --count;
1.5 if (!count) {
1.6 StopKeyserverLookup();
1.7 - ::log_event(session(), "Shutdown", "pEp COM Adapter", NULL, NULL);
1.8 + try {
1.9 + // try/catch to avoid freeze when no session could be initialized because a runtime
1.10 + // or other kind of exceptions thrown by engine
1.11 + ::log_event(session(), "Shutdown", "pEp COM Adapter", NULL, NULL);
1.12 + }
1.13 + catch (pEp::RuntimeError& ex) { // runtime
1.14 + error(ex.what());
1.15 + }
1.16 + catch (std::exception& ex) { // bad alloc or invalid argument
1.17 + error(ex.what());
1.18 + }
1.19 session(pEp::Adapter::release);
1.20 shutdown();
1.21