diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp index d30bfb5a9..0d779de88 100644 --- a/kit/ChildSession.cpp +++ b/kit/ChildSession.cpp @@ -1222,16 +1222,11 @@ bool ChildSession::selectText(const char* /*buffer*/, int /*length*/, const std: bool ChildSession::renderWindow(const char* /*buffer*/, int /*length*/, const std::vector& tokens) { + const unsigned winId = (tokens.size() > 1 ? std::stoul(tokens[1]) : 0); + std::unique_lock lock(_docManager.getDocumentMutex()); getLOKitDocument()->setView(_viewId); - unsigned winId = 0; - if (tokens.size() > 1) - { - std::istringstream reader(tokens[1]); - reader >> winId; - } - int startX = 0, startY = 0; int bufferWidth = 800, bufferHeight = 600; double dpiScale = 1.0; @@ -1298,18 +1293,11 @@ bool ChildSession::renderWindow(const char* /*buffer*/, int /*length*/, const st bool ChildSession::sendWindowCommand(const char* /*buffer*/, int /*length*/, const std::vector& tokens) { + const unsigned winId = (tokens.size() > 1 ? std::stoul(tokens[1]) : 0); + std::unique_lock lock(_docManager.getDocumentMutex()); getLOKitDocument()->setView(_viewId); - unsigned winId = 0; - if (tokens.size() > 1) - { - std::istringstream reader(tokens[1]); - reader >> winId; - } - - getLOKitDocument()->setView(_viewId); - if (tokens.size() > 2 && tokens[2] == "close") getLOKitDocument()->postWindow(winId, LOK_WINDOW_CLOSE);