Don't call std::_Exit() in the mobile app

Instead we should just exit the thread(s) that serve the document that
was being edited, and the app should return to showing the document
browser. (Or whatever we eventually will have as its state when the
user is not editing or viewing a document.) Work in progress.
This commit is contained in:
Tor Lillqvist 2018-10-15 15:29:50 +03:00
parent 116510296e
commit 7073d4feca

View file

@ -897,11 +897,13 @@ public:
} }
num_sessions = _sessions.size(); num_sessions = _sessions.size();
#ifndef MOBILEAPP
if (num_sessions == 0) if (num_sessions == 0)
{ {
LOG_INF("Document [" << _url << "] has no more views, exiting bluntly."); LOG_INF("Document [" << _url << "] has no more views, exiting bluntly.");
std::_Exit(Application::EXIT_OK); std::_Exit(Application::EXIT_OK);
} }
#endif
} }
// Don't destroy sessions while holding our lock. // Don't destroy sessions while holding our lock.
@ -1375,12 +1377,13 @@ private:
if (viewCount == 1) if (viewCount == 1)
{ {
std::unique_lock<std::mutex> lock(_mutex); std::unique_lock<std::mutex> lock(_mutex);
#ifndef MOBILEAPP
if (_sessions.empty()) if (_sessions.empty())
{ {
LOG_INF("Document [" << _url << "] has no more views, exiting bluntly."); LOG_INF("Document [" << _url << "] has no more views, exiting bluntly.");
std::_Exit(Application::EXIT_OK); std::_Exit(Application::EXIT_OK);
} }
#endif
LOG_INF("Document [" << _url << "] has no more views, but has " << LOG_INF("Document [" << _url << "] has no more views, but has " <<
_sessions.size() << " sessions still. Destroying the document."); _sessions.size() << " sessions still. Destroying the document.");
_loKitDocument.reset(); _loKitDocument.reset();