Switch to the correct view before calling getSelectionType() method.

This method needs to be called with having the correct view activated.

It caused a crash in writer/simultaneous_typing multi-user cypress test.

Signed-off-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Change-Id: I57dd58a635ce7ea127200a6a3f0cadc8c0861aaf
This commit is contained in:
Tamás Zolnai 2021-01-18 19:39:07 +01:00 committed by Tamás Zolnai
parent f292ff4eb7
commit 218e47e65a

View file

@ -1031,6 +1031,7 @@ bool ChildSession::getTextSelection(const char* /*buffer*/, int /*length*/, cons
}
std::string selection;
getLOKitDocument()->setView(_viewId);
const int selectionType = getLOKitDocument()->getSelectionType();
if (selectionType == LOK_SELTYPE_LARGE_TEXT || selectionType == LOK_SELTYPE_COMPLEX ||
(selection = getTextSelectionInternal(mimeType)).size() >= 1024 * 1024) // Don't return huge data.