svx/source/accessibility/AccessibleTextHelper.cxx | 20 +++++++++++--------- vcl/source/treelist/treelistbox.cxx | 6 +++--- 2 files changed, 14 insertions(+), 12 deletions(-)
New commits: commit a9ee71097a246edea9581a4f997d13467b7189ee Author: Mike Kaganski <[email protected]> AuthorDate: Sat May 28 20:04:40 2022 +0200 Commit: Mike Kaganski <[email protected]> CommitDate: Sun Jun 5 07:53:18 2022 +0200 Fix failing assert on shutdown with NVDA active The stack trace at the moment of calling implLookupClient with nClient == -1 was: > ucrtbased.dll!abort() Line 61 C++ > ucrtbased.dll!common_assert_to_stderr<wchar_t>(const wchar_t * const expression, const wchar_t * const file_name, const unsigned int line_number) Line 187 C++ > ucrtbased.dll!common_assert<wchar_t>(const wchar_t * const expression, const wchar_t * const file_name, const unsigned int line_number, void * const return_address) Line 420 C++ > ucrtbased.dll!_wassert(const wchar_t * expression, const wchar_t * file_name, unsigned int line_number) Line 444 C++ > comphelper.dll!`anonymous namespace'::implLookupClient(const unsigned long nClient, std::_Tree_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<unsigned long const ,comphelper::OInterfaceContainerHelper4<com::sun::star::accessibility::XAccessibleEventListener> *>>>> & rPos) Line 139 C++ > comphelper.dll!comphelper::AccessibleEventNotifier::addEvent(const unsigned long _nClient, const com::sun::star::accessibility::AccessibleEventObject & _rEvent) Line 249 C++ > svxlo.dll!accessibility::AccessibleTextHelper_Impl::FireEvent(const com::sun::star::accessibility::AccessibleEventObject & rEvent) Line 1416 C++ > svxlo.dll!accessibility::AccessibleTextHelper_Impl::FireEvent(const short nEventId, const com::sun::star::uno::Any & rNewValue, const com::sun::star::uno::Any & rOldValue) Line 1408 C++ > svxlo.dll!accessibility::AccessibleTextHelper_Impl::ShutdownEditSource() Line 700 C++ > svxlo.dll!accessibility::AccessibleTextHelper_Impl::SetEditSource(std::unique_ptr<SvxEditSource,std::default_delete<SvxEditSource>> && pEditSource) Line 717 C++ > svxlo.dll!accessibility::AccessibleTextHelper::SetEditSource(std::unique_ptr<SvxEditSource,std::default_delete<SvxEditSource>> && pEditSource) Line 1548 C++ > svxlo.dll!WeldEditAccessible::ClearWin() Line 552 C++ > svxlo.dll!WeldEditView::~WeldEditView() Line 864 C++ > smlo.dll!SmEditTextWindow::~SmEditTextWindow() Line 85 C++ > smlo.dll!SmEditTextWindow::`scalar deleting destructor'(unsigned int) C++ > smlo.dll!std::default_delete<SmEditTextWindow>::operator()(SmEditTextWindow * _Ptr) Line 3129 C++ > smlo.dll!std::unique_ptr<SmEditTextWindow,std::default_delete<SmEditTextWindow>>::reset(SmEditTextWindow * _Ptr) Line 3276 C++ > smlo.dll!SmEditWindow::DeleteEditView() Line 853 C++ > smlo.dll!SmEditWindow::~SmEditWindow() Line 139 C++ > smlo.dll!SmEditWindow::`scalar deleting destructor'(unsigned int) C++ > smlo.dll!o3tl::default_delete<SmEditWindow>::operator()(SmEditWindow * p) Line 46 C++ > smlo.dll!std::unique_ptr<SmEditWindow,o3tl::default_delete<SmEditWindow>>::reset(SmEditWindow * _Ptr) Line 3276 C++ > smlo.dll!SmCmdBoxWindow::dispose() Line 931 C++ > vcllo.dll!VclReferenceBase::disposeOnce() Line 39 C++ > sfxlo.dll!VclPtr<vcl::Window>::disposeAndClear() Line 206 C++ > sfxlo.dll!SfxChildWindow::~SfxChildWindow() Line 198 C++ > smlo.dll!SmCmdBoxWrapper::~SmCmdBoxWrapper() C++ > smlo.dll!SmCmdBoxWrapper::`scalar deleting destructor'(unsigned int) C++ > sfxlo.dll!SfxChildWindow::Destroy() Line 176 C++ > sfxlo.dll!SfxWorkWindow::DeleteControllers_Impl() Line 599 C++ > sfxlo.dll!SfxFrame::DoClose_Impl() Line 133 C++ > sfxlo.dll!SfxBaseController::dispose() Line 981 C++ > fwklo.dll!`anonymous namespace'::XFrameImpl::setComponent(const com::sun::star::uno::Reference<com::sun::star::awt::XWindow> & xComponentWindow, const com::sun::star::uno::Reference<com::sun::star::frame::XController> & xController) Line 1485 C++ > fwklo.dll!`anonymous namespace'::XFrameImpl::close(unsigned char bDeliverOwnership) Line 1696 C++ > fwklo.dll!framework::Desktop::impl_closeFrames(bool bAllowUI) Line 1702 C++ > fwklo.dll!framework::Desktop::terminate() Line 214 C++ > fwklo.dll!framework::CloseDispatcher::implts_terminateApplication() Line 543 C++ > fwklo.dll!framework::CloseDispatcher::impl_asyncCallback(LinkParamNone * __formal) Line 397 C++ > fwklo.dll!framework::CloseDispatcher::LinkStubimpl_asyncCallback(void * instance, LinkParamNone * data) Line 245 C++ > vcllo.dll!Link<LinkParamNone *,void>::Call(LinkParamNone * data) Line 111 C++ > vcllo.dll!vcl::EventPoster::DoEvent_Impl(void * __formal) Line 53 C++ > vcllo.dll!vcl::EventPoster::LinkStubDoEvent_Impl(void * instance, void * data) Line 48 C++ > vcllo.dll!Link<void *,void>::Call(void * data) Line 111 C++ > vcllo.dll!ImplHandleUserEvent(ImplSVEvent * pSVEvent) Line 2232 C++ > vcllo.dll!ImplWindowFrameProc(vcl::Window * _pWindow, SalEvent nEvent, const void * pEvent) Line 2800 C++ > vcllo.dll!SalFrame::CallCallback(SalEvent nEvent, const void * pEvent) Line 308 C++ > vclplug_winlo.dll!ImplHandleUserEvent(HWND__ * hWnd, __int64 lParam) Line 4214 C++ > vclplug_winlo.dll!SalFrameWndProc(HWND__ * hWnd, unsigned int nMsg, unsigned __int64 wParam, __int64 lParam, bool & rDef) Line 5865 C++ > vclplug_winlo.dll!SalFrameWndProcW(HWND__ * hWnd, unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Line 5972 C++ > user32.dll!UserCallWinProcCheckWow() Unknown > user32.dll!DispatchMessageWorker() Unknown > vclplug_winlo.dll!ImplSalDispatchMessage(const tagMSG * pMsg) Line 475 C++ > vclplug_winlo.dll!ImplSalYield(bool bWait, bool bHandleAllCurrentEvents) Line 506 C++ > vclplug_winlo.dll!WinSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents) Line 581 C++ > vcllo.dll!ImplYield(bool i_bWait, bool i_bAllEvents) Line 474 C++ > vcllo.dll!Application::Yield() Line 559 C++ > vcllo.dll!Application::Execute() Line 452 C++ > sofficeapp.dll!desktop::Desktop::Main() Line 1600 C++ > vcllo.dll!ImplSVMain() Line 202 C++ > vcllo.dll!SVMain() Line 235 C++ > sofficeapp.dll!soffice_main() Line 94 C++ > soffice.bin!sal_main() Line 51 C > soffice.bin!main(int argc, char * * argv) Line 49 C Firing the event when we already set the id to mean "revoked" seems wrong. Also use the correct type for the id. Change-Id: Ie2e180c0c8c112023f789968ffa785f046de9d76 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135058 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135413 Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx b/svx/source/accessibility/AccessibleTextHelper.cxx index 046fec99224b..8fb67a4d56d7 100644 --- a/svx/source/accessibility/AccessibleTextHelper.cxx +++ b/svx/source/accessibility/AccessibleTextHelper.cxx @@ -170,7 +170,7 @@ namespace accessibility virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; - int getNotifierClientId() const { return mnNotifierClientId; } + comphelper::AccessibleEventNotifier::TClientId getNotifierClientId() const { return mnNotifierClientId; } // lock solar mutex before SvxTextForwarder& GetTextForwarder() const; @@ -222,7 +222,9 @@ namespace accessibility Point maOffset; /// client Id from AccessibleEventNotifier - int mnNotifierClientId; + comphelper::AccessibleEventNotifier::TClientId mnNotifierClientId; + static constexpr comphelper::AccessibleEventNotifier::TClientId snNotifierClientRevoked + = std::numeric_limits<comphelper::AccessibleEventNotifier::TClientId>::max(); }; AccessibleTextHelper_Impl::AccessibleTextHelper_Impl() : @@ -1353,7 +1355,7 @@ namespace accessibility void AccessibleTextHelper_Impl::Dispose() { - if( getNotifierClientId() != -1 ) + if( getNotifierClientId() != snNotifierClientRevoked) { try { @@ -1363,7 +1365,7 @@ namespace accessibility } catch( const uno::Exception& ) {} - mnNotifierClientId = -1; + mnNotifierClientId = snNotifierClientRevoked; } try @@ -1415,8 +1417,8 @@ namespace accessibility vcl::unohelper::NotifyAccessibleStateEventGlobally( rEvent ); // #106234# Delegate to EventNotifier - ::comphelper::AccessibleEventNotifier::addEvent( getNotifierClientId(), - rEvent ); + if (getNotifierClientId() != snNotifierClientRevoked) + ::comphelper::AccessibleEventNotifier::addEvent( getNotifierClientId(), rEvent ); } // XAccessibleContext @@ -1445,13 +1447,13 @@ namespace accessibility void AccessibleTextHelper_Impl::addAccessibleEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) { - if( getNotifierClientId() != -1 ) + if( getNotifierClientId() != snNotifierClientRevoked ) ::comphelper::AccessibleEventNotifier::addEventListener( getNotifierClientId(), xListener ); } void AccessibleTextHelper_Impl::removeAccessibleEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) { - if( getNotifierClientId() == -1 ) + if( getNotifierClientId() == snNotifierClientRevoked ) return; const sal_Int32 nListenerCount = ::comphelper::AccessibleEventNotifier::removeEventListener( getNotifierClientId(), xListener ); @@ -1462,7 +1464,7 @@ namespace accessibility // and at least to us not firing any events anymore, in case somebody calls // NotifyAccessibleEvent, again ::comphelper::AccessibleEventNotifier::TClientId nId( getNotifierClientId() ); - mnNotifierClientId = -1; + mnNotifierClientId = snNotifierClientRevoked; ::comphelper::AccessibleEventNotifier::revokeClient( nId ); } } commit 4d023df5ed697b67845171db8ea142b3bd6b0288 Author: Mike Kaganski <[email protected]> AuthorDate: Fri May 27 15:10:52 2022 +0200 Commit: Mike Kaganski <[email protected]> CommitDate: Sun Jun 5 07:53:04 2022 +0200 Drop useless text width calculation It came from SvTreeListBox::GetHeightOffset dropped in commit 7da765dde1800aa607f96e7a5807582ad2894acb Author Noel Grandin <[email protected]> Date Thu Oct 27 10:21:42 2016 +0200 loplugin:expandablemethods in svtools Possibly the calculation was used for something else GetHeightOffset used before. Change-Id: I2a13035e0852637529c40a0ffe1bd0e2b8b3d077 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135010 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135412 Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx index f2ec419891be..cef262241d15 100644 --- a/vcl/source/treelist/treelistbox.cxx +++ b/vcl/source/treelist/treelistbox.cxx @@ -2032,10 +2032,10 @@ void SvTreeListBox::AdjustEntryHeight( const Image& rBmp ) void SvTreeListBox::AdjustEntryHeight() { - Size aSize( GetTextWidth(OUString('X')), GetTextHeight() ); - if( aSize.Height() > nEntryHeight ) + tools::Long nHeight = GetTextHeight(); + if( nHeight > nEntryHeight ) { - nEntryHeight = static_cast<short>(aSize.Height()) + nEntryHeightOffs; + nEntryHeight = static_cast<short>(nHeight) + nEntryHeightOffs; pImpl->SetEntryHeight(); } }
