vcl/jsdialog/executor.cxx |    3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 62b81789a7c16925c4b15692e40b1da6badb73d1
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Mon Jan 20 13:20:27 2025 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Mon Jan 20 14:32:44 2025 +0100

    jsdialog: scroll to row before use
    
    If we first select lat row, then try to select some top row
    in LOK -> we will not get correct result for popup menu
    as the coordinates will be negative and we will also fail
    on assertion. We need to scroll row to be visible first
    
    Change-Id: Ib8a76eff093817fe7e3a777aa8cecf1246fae25f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180504
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index badd5c834193..48535f2fb70d 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -583,6 +583,9 @@ bool ExecuteAction(const OUString& nWindowId, const 
OUString& rWidget, StringMap
                     std::unique_ptr<weld::TreeIter> 
itEntry(pTreeView->make_iterator());
                     if (pTreeView->get_iter_abs_pos(*itEntry, nEntryAbsPos))
                     {
+                        // avoid negative coordinates and crash
+                        pTreeView->scroll_to_row(*itEntry);
+
                         tools::Rectangle aRect = 
pTreeView->get_row_area(*itEntry);
                         Point aPoint = aRect.Center();
                         assert(aPoint.getX() >= 0 && aPoint.getY() >= 0);

Reply via email to