Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: data loss when shutting down while using typer #8558

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions browser/src/core/Socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,8 @@ app.definitions.Socket = L.Class.extend({
else if (textMsg === 'shuttingdown') {
msg = _('Server is shutting down for maintenance (auto-saving)');
postMsgData['Reason'] = 'ShuttingDown';
app.idleHandler._active = false;
app.idleHandler._serverRecycling = true;
}
else if (textMsg === 'docdisconnected') {
msg = _('Oops, there is a problem connecting the document');
Expand Down Expand Up @@ -1223,6 +1225,11 @@ app.definitions.Socket = L.Class.extend({
else if (textMsg.startsWith('statusindicatorfinish:')) {
this._map.fire('statusindicator', {statusType : 'finish'});
this._map._fireInitComplete('statusindicatorfinish');
// show shutting down popup after saving is finished
// if we show the popup just after the shuttingdown messsage, it will be overwitten by save popup
if (app.idleHandler._serverRecycling) {
this._map.showBusy(_('Server is shutting down'), false);
}
return;
}
}
Expand Down
2 changes: 2 additions & 0 deletions wsd/COOLWSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6320,6 +6320,8 @@ int COOLWSD::innerMain()
// atexit handlers tend to free Admin before Documents
LOG_INF("Exiting. Cleaning up lingering documents.");
#if !MOBILEAPP
COOLWSD::alertAllUsersInternal("close: shuttingdown");

if (!SigUtil::getShutdownRequestFlag())
{
// This shouldn't happen, but it's fail safe to always cleanup properly.
Expand Down
8 changes: 7 additions & 1 deletion wsd/DocumentBroker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3654,6 +3654,13 @@ bool DocumentBroker::forwardToChild(const std::shared_ptr<ClientSession>& sessio
return true;
}

// Ignore textinput, mouse and key message when document is unloading
if (isUnloading() && (Util::startsWith(message, "textinput ") ||
Util::startsWith(message, "mouse ") || Util::startsWith(message, "key ")))
{
return true;
}

const std::string viewId = session->getId();

LOG_TRC("Forwarding payload to child [" << viewId << "]: " << getAbbreviatedMessage(message));
Expand Down Expand Up @@ -3779,7 +3786,6 @@ void DocumentBroker::terminateChild(const std::string& closeReason)

_childProcess->close();
}

stop(closeReason);
}

Expand Down