desktop/source/lib/init.cxx | 2 +- include/sfx2/viewsh.hxx | 1 + include/vcl/IDialogRenderable.hxx | 3 +++ include/vcl/svapp.hxx | 2 +- sfx2/source/view/lokhelper.cxx | 3 ++- sfx2/source/view/viewsh.cxx | 23 +++++++++++++++++++++++ vcl/source/app/svapp.cxx | 16 ++++++++++++++++ 7 files changed, 47 insertions(+), 3 deletions(-)
New commits: commit e2aab0d02e7be66881f2ac0f08b6ac5007f65648 Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Thu May 16 19:35:51 2024 +0100 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Sat May 18 12:34:59 2024 +0200 lok: dump more SfxViewShell state, and LOK notifier state on Windows. This should help to associate the right view-ids, with the right windows, and help to catch any stray / lingering windows from closed sessions - hopefully. Change-Id: I197a3280d5d2aeddd356ee037c51e4887f43278b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167765 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> (cherry picked from commit 8d979fae0c435b820302c76fcfdc2642b4820360) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167684 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.me...@collabora.com> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 2ab701cae3d2..3b4b9f11a4d4 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1637,7 +1637,7 @@ void CallbackFlushHandler::libreOfficeKitViewUpdatedCallbackPerViewId(int nType, void CallbackFlushHandler::dumpState(rtl::OStringBuffer &rState) { // NB. no locking - rState.append(" View: "); + rState.append(" View: "); rState.append(static_cast<sal_Int32>(m_viewId)); rState.append(" DisableCallbacks: "); rState.append(static_cast<sal_Int32>(m_nDisableCallbacks)); diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index b7461b160af1..71380213b9c9 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -274,6 +274,7 @@ public: // ILibreOfficeKitNotifier virtual void notifyWindow(vcl::LOKWindowId nLOKWindowId, const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload = std::vector<vcl::LOKPayloadItem>()) const override; + virtual OString dumpNotifyState() const override; // Focus, KeyInput, Cursor virtual void ShowCursor( bool bOn = true ); diff --git a/include/vcl/IDialogRenderable.hxx b/include/vcl/IDialogRenderable.hxx index 386ed1e865c8..d92eb88ed25c 100644 --- a/include/vcl/IDialogRenderable.hxx +++ b/include/vcl/IDialogRenderable.hxx @@ -41,6 +41,9 @@ public: /// Emits a LOK_CALLBACK_INVALIDATE_TILES. virtual void notifyInvalidation(tools::Rectangle const *) const = 0; + + /// Debugging + virtual OString dumpNotifyState() const = 0; }; } // namespace vcl diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx index d5f1739be1ae..2725642763c0 100644 --- a/include/vcl/svapp.hxx +++ b/include/vcl/svapp.hxx @@ -1326,7 +1326,7 @@ public: const std::vector<vcl::LOKPayloadItem>& rPayload = std::vector<vcl::LOKPayloadItem>()) const override; virtual void libreOfficeKitViewCallback(int nType, const OString& pPayload) const override; virtual void notifyInvalidation(tools::Rectangle const *) const override; - + virtual OString dumpNotifyState() const override; private: DECL_DLLPRIVATE_STATIC_LINK( Application, PostEventHandler, void*, void ); diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index 756fda428273..549f43906908 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -735,7 +735,8 @@ void SfxLokHelper::notifyPartSizeChangedAllViews(vcl::ITiledRenderable* pDoc, in SfxViewShell* pViewShell = SfxViewShell::GetFirst(); while (pViewShell) { - if (pViewShell->getPart() == nPart) + if (// FIXME should really filter on pViewShell->GetDocId() too + pViewShell->getPart() == nPart) SfxLokHelper::notifyDocumentSizeChanged(pViewShell, ""_ostr, pDoc, false); pViewShell = SfxViewShell::GetNext(*pViewShell); } diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index df122f41054f..b5f010e9b0be 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -3173,6 +3173,20 @@ SfxLokCallbackInterface* SfxViewShell::getLibreOfficeKitViewCallback() const void SfxViewShell::dumpLibreOfficeKitViewState(rtl::OStringBuffer &rState) { + rState.append(" SfxViewShell: "); + rState.append(OString::number(reinterpret_cast<sal_uInt64>(this), 16)); + rState.append(" DocId: "); + auto nDocId = static_cast<int>(GetDocId()); + rState.append(static_cast<sal_Int32>(nDocId)); + rState.append(" ViewId: "); + rState.append(static_cast<sal_Int32>(GetViewShellId())); + rState.append(" Part: "); + rState.append(static_cast<sal_Int32>(getPart())); + rState.append(" Lang: "); + rState.append(OUStringToOString(GetLOKLanguageTag().getBcp47(), RTL_TEXTENCODING_UTF8)); + rState.append(" A11y: "); + rState.append(GetLOKAccessibilityState() ? "enabled" : "disabled"); + if (pImpl->m_pLibreOfficeKitViewCallback) pImpl->m_pLibreOfficeKitViewCallback->dumpState(rState); } @@ -3857,6 +3871,15 @@ void SfxViewShell::notifyWindow(vcl::LOKWindowId nDialogId, const OUString& rAct SfxLokHelper::notifyWindow(this, nDialogId, rAction, rPayload); } +OString SfxViewShell::dumpNotifyState() const +{ + return OString("sfxviewsh: " + + OString::number(reinterpret_cast<sal_uInt64>(this), 16) + + " doc: " + OString::number(static_cast<sal_Int32>(static_cast<int>(GetDocId()))) + + " view: " + + OString::number(static_cast<sal_Int32>(GetViewShellId()))); +} + uno::Reference< datatransfer::clipboard::XClipboardNotifier > SfxViewShell::GetClipboardNotifier() const { uno::Reference< datatransfer::clipboard::XClipboardNotifier > xClipboardNotifier; diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index b3a63cd05a46..af0b1fcd683b 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -319,6 +319,12 @@ void Application::notifyWindow(vcl::LOKWindowId /*nLOKWindowId*/, SAL_WARN("vcl", "Invoked not implemented method: Application::notifyWindow"); } +OString Application::dumpNotifyState() const +{ + SAL_WARN("vcl", "Invoked not implemented method: Application::dumpNotifyState"); + return "notimpl"_ostr; +} + void Application::libreOfficeKitViewCallback(int nType, const OString& pPayload) const { if (!comphelper::LibreOfficeKit::isActive()) @@ -1754,6 +1760,16 @@ void dumpState(rtl::OStringBuffer &rState) pWin->DumpAsPropertyTree(aProps); rState.append(" Window: "); + + auto notifier = pWin->GetLOKNotifier(); + if (notifier) + { + rState.append(notifier->dumpNotifyState()); + rState.append(" "); + } + else + rState.append("no notifier "); + OString aPropStr = aProps.finishAndGetAsOString(); if (aPropStr.getLength() > 256) {