desktop/source/lib/init.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
New commits: commit 970603193683a05f1235a86038d4a393f87a26fe Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Fri Jul 25 16:04:04 2025 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Tue Jul 29 15:24:11 2025 +0200 use SfxLokHelper::getViewId to get view of this document get ObjectShell from the ViewShell Change-Id: I257ebf83d9f05c2fafecd92886a853fcb995abdb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188355 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index af7dd155bba8..08cc32f74980 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -5401,7 +5401,6 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma SolarMutexGuard aGuard; SetLastExceptionMsg(); - SfxObjectShell* pDocSh = SfxObjectShell::Current(); OUString aCommand(pCommand, strlen(pCommand), RTL_TEXTENCODING_UTF8); if (!isCommandAllowed(aCommand)) @@ -5422,9 +5421,12 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma aPropertyValuesVector.push_back(aSynchronMode); } - int nView = SfxLokHelper::getCurrentView(); - if (nView < 0) + const int nView = SfxLokHelper::getViewId(pDocument->mnDocumentId); + SfxViewShell* pViewShell = SfxLokHelper::getViewOfId(nView); + if (!pViewShell) return; + assert(nView == pViewShell->GetViewShellId().get() && "otherwise we couldn't have found it"); + SfxObjectShell* pDocSh = pViewShell->GetObjectShell(); if (gImpl && aCommand == ".uno:ToggleOrientation") { @@ -5495,7 +5497,6 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma else if (gImpl && aCommand == ".uno:TransformDialog") { bool bNeedConversion = false; - SfxViewShell* pViewShell = SfxViewShell::Current(); LokChartHelper aChartHelper(pViewShell); if (aChartHelper.GetWindow() )