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

New commits:
commit d09ca3730a20341a0abf2c07b7a3d1cbac1bf90c
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Mon Jan 20 13:20:27 2025 +0100
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Mon Jan 20 16:10:22 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
    (cherry picked from commit 62b81789a7c16925c4b15692e40b1da6badb73d1)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180509
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index 2385c19f4a4a..e5ea1f19a770 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);
                         CommandEvent aCommand(aRect.Center(), 
CommandEventId::ContextMenu);
 

Reply via email to