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 8d979fae0c435b820302c76fcfdc2642b4820360 Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Thu May 16 19:35:51 2024 +0100 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Fri May 17 17:41:40 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> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index a61eb3ff0879..298d15b4ddf6 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1660,7 +1660,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 e68f556c1072..d098d76d0031 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 49e22c3c5357..11a7adfb0f27 100644 --- a/include/vcl/IDialogRenderable.hxx +++ b/include/vcl/IDialogRenderable.hxx @@ -42,6 +42,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 36d7eeb1fc06..be1e80090576 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 8df19c359442..99f39fbf4e8b 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -733,7 +733,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 75731ecf1ccd..0b6c07c68d5c 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -3181,6 +3181,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); } @@ -3865,6 +3879,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 34b2774995f1..55978909a480 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -335,6 +335,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()) @@ -1762,6 +1768,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) {