svtools/source/dialogs/PlaceEditDialog.cxx |    2 ++
 vcl/inc/qt5/QtInstanceScrolledWindow.hxx   |    4 ++++
 vcl/qt5/QtInstanceScrolledWindow.cxx       |   20 ++++++++++++++++++++
 3 files changed, 26 insertions(+)

New commits:
commit 55b2355e5a95a1dd8410a63036f8f9dec6054eb0
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Aug 1 16:20:16 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sat Aug 2 09:16:15 2025 +0200

    tdf#130857 svtools: Check index in File Services dlg
    
    In PlaceEditDialog::SelectType, only use the index
    of the currently active combobox entry if it's non-negative,
    i.e. an entry is actually active.
    
    This fixes a crash/assert seen with upcoming
    
        Change-Id: I76af9a925903218dbc612532c06857837395b317
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Fri Aug 1 16:37:36 2025 +0200
    
            tdf#130857 qt weld: Support file services dialog
    
            This means that native Qt widgets are used for that dialog
            now when using the qt5 or qt6 VCL plugin and starting LO with
            environment variable SAL_VCL_QT_USE_WELDED_WIDGETS=1 set.
    
            This dialog can be triggered as follows:
    
            * "File" -> "Open Remote"
            * "Manage Services" -> "Add service"
    
    because PlaceEditDialog::SelectType
    explicitly sets the index to -1 (frame 34), which results
    in a notification about the index having changed, and
    then PlaceEditDialog::SelectType gets called again (frame 7)
    and uses the index of -1 to try to access a vector element.
    
    (This doesn't happen with the GTK or VCL implementations because
    those explicitly disable signals in their weld::Combobox::set_active
    implementations, which the Qt implementation might also do at some
    point, but checking the index seems reasonable in any case.)
    
    Backtrace:
    
        1 __pthread_kill_implementation pthread_kill.c 44 0x7ffff789e95c
        2 __pthread_kill_internal pthread_kill.c 89 0x7ffff789e9ff
        3 __GI_raise raise.c 26 0x7ffff7849cc2
        4 __GI_abort abort.c 73 0x7ffff78324ac
        5 ?? 0x7ffff74a41a6
        6 std::vector<std::shared_ptr<DetailsContainer>>::operator[] vector 508 
0x7ffff09a9bf3
        7 PlaceEditDialog::SelectType PlaceEditDialog.cxx 352 0x7ffff09a8020
        8 PlaceEditDialog::SelectTypeHdl PlaceEditDialog.cxx 334 0x7ffff09a940b
        9 PlaceEditDialog::LinkStubSelectTypeHdl PlaceEditDialog.cxx 332 
0x7ffff09a5b7d
        10 Link<weld::ComboBox&, void>::Call link.hxx 105 0x7fffe626af51
        11 weld::ComboBox::signal_changed weld.hxx 774 0x7fffe626ab5c
        12 QtInstanceComboBox::signalChanged QtInstanceComboBox.cxx 382 
0x7fffe6260f9d
        13 QtPrivate::FunctorCall<std::integer_sequence<unsigned long>, 
QtPrivate::List<>, void, void (QtInstanceComboBox:: *)()>::call(void 
(QtInstanceComboBox:: *)(), QtInstanceComboBox *, void * 
*)::{lambda()#1}::operator()() const qobjectdefs_impl.h 127 0x7fffe626b371
        14 QtPrivate::FunctorCallBase::call_internal<void, 
QtPrivate::FunctorCall<std::integer_sequence<unsigned long>, QtPrivate::List<>, 
void, void (QtInstanceComboBox:: *)()>::call(void (QtInstanceComboBox:: *)(), 
QtInstanceComboBox *, void * *)::{lambda()#1}>(void * *, 
QtPrivate::FunctorCall<std::integer_sequence<unsigned long>, QtPrivate::List<>, 
void, void (QtInstanceComboBox:: *)()>::call(void (QtInstanceComboBox:: *)(), 
QtInstanceComboBox *, void * *)::{lambda()#1}&&) qobjectdefs_impl.h 65 
0x7fffe626b2a9
        15 QtPrivate::FunctorCall<std::integer_sequence<unsigned long>, 
QtPrivate::List<>, void, void (QtInstanceComboBox:: *)()>::call(void 
(QtInstanceComboBox:: *)(), QtInstanceComboBox *, void * *) qobjectdefs_impl.h 
126 0x7fffe626b1db
        16 QtPrivate::FunctionPointer<void (QtInstanceComboBox:: 
*)()>::call<QtPrivate::List<>, void>(void (QtInstanceComboBox:: *)(), 
QtInstanceComboBox *, void * *) qobjectdefs_impl.h 174 0x7fffe626b15d
        17 QtPrivate::QCallableObject<void (QtInstanceComboBox:: *)(), 
QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, 
void * *, bool *) qobjectdefs_impl.h 545 0x7fffe626b086
        18 QtPrivate::QSlotObjectBase::call qobjectdefs_impl.h 461 
0x7fffe5107b62
        19 doActivate<false> qobject.cpp 4284 0x7fffe533000f
        20 QMetaObject::activate qobject.cpp 4344 0x7fffe5326163
        21 QMetaObject::activate<void, QString> qobjectdefs.h 319 0x7fffe32b9abb
        22 QComboBox::currentTextChanged moc_qcombobox.cpp 374 0x7fffe3471721
        23 QComboBoxPrivate::updateCurrentText qcombobox.cpp 2963 0x7fffe346eb8d
        24 QComboBoxPrivate::emitCurrentIndexChanged qcombobox.cpp 1459 
0x7fffe346ee6e
        25 QComboBoxPrivate::setCurrentIndex qcombobox.cpp 2244 0x7fffe3469e7b
        26 QComboBox::setCurrentIndex qcombobox.cpp 2191 0x7fffe34692aa
        27 QtInstanceComboBox::set_active(int)::$_0::operator()() const 
QtInstanceComboBox.cxx 124 0x7fffe6266952
        28 std::__invoke_impl<void, 
QtInstanceComboBox::set_active(int)::$_0&>(std::__invoke_other, 
QtInstanceComboBox::set_active(int)::$_0&) invoke.h 61 0x7fffe6266925
        29 std::__invoke_r<void, 
QtInstanceComboBox::set_active(int)::$_0&>(QtInstanceComboBox::set_active(int)::$_0&)
 invoke.h 111 0x7fffe62668d5
        30 std::_Function_handler<void(), 
QtInstanceComboBox::set_active(int)::$_0>::_M_invoke std_function.h 290 
0x7fffe62667ed
        31 std::function<void()>::operator() std_function.h 591 0x7fffe621323e
        32 QtInstance::RunInMainThread QtInstance.cxx 205 0x7fffe620a3df
        33 QtInstanceComboBox::set_active QtInstanceComboBox.cxx 124 
0x7fffe6262269
        34 PlaceEditDialog::SelectType PlaceEditDialog.cxx 344 0x7ffff09a7fc3
        35 PlaceEditDialog::SelectTypeHdl PlaceEditDialog.cxx 334 0x7ffff09a940b
        36 PlaceEditDialog::LinkStubSelectTypeHdl PlaceEditDialog.cxx 332 
0x7ffff09a5b7d
        37 Link<weld::ComboBox&, void>::Call link.hxx 105 0x7fffe626af51
        38 weld::ComboBox::signal_changed weld.hxx 774 0x7fffe626ab5c
        39 QtInstanceComboBox::signalChanged QtInstanceComboBox.cxx 382 
0x7fffe6260f9d
        40 QtPrivate::FunctorCall<std::integer_sequence<unsigned long>, 
QtPrivate::List<>, void, void (QtInstanceComboBox:: *)()>::call(void 
(QtInstanceComboBox:: *)(), QtInstanceComboBox *, void * 
*)::{lambda()#1}::operator()() const qobjectdefs_impl.h 127 0x7fffe626b371
        41 QtPrivate::FunctorCallBase::call_internal<void, 
QtPrivate::FunctorCall<std::integer_sequence<unsigned long>, QtPrivate::List<>, 
void, void (QtInstanceComboBox:: *)()>::call(void (QtInstanceComboBox:: *)(), 
QtInstanceComboBox *, void * *)::{lambda()#1}>(void * *, 
QtPrivate::FunctorCall<std::integer_sequence<unsigned long>, QtPrivate::List<>, 
void, void (QtInstanceComboBox:: *)()>::call(void (QtInstanceComboBox:: *)(), 
QtInstanceComboBox *, void * *)::{lambda()#1}&&) qobjectdefs_impl.h 65 
0x7fffe626b2a9
        42 QtPrivate::FunctorCall<std::integer_sequence<unsigned long>, 
QtPrivate::List<>, void, void (QtInstanceComboBox:: *)()>::call(void 
(QtInstanceComboBox:: *)(), QtInstanceComboBox *, void * *) qobjectdefs_impl.h 
126 0x7fffe626b1db
        43 QtPrivate::FunctionPointer<void (QtInstanceComboBox:: 
*)()>::call<QtPrivate::List<>, void>(void (QtInstanceComboBox:: *)(), 
QtInstanceComboBox *, void * *) qobjectdefs_impl.h 174 0x7fffe626b15d
        44 QtPrivate::QCallableObject<void (QtInstanceComboBox:: *)(), 
QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, 
void * *, bool *) qobjectdefs_impl.h 545 0x7fffe626b086
        45 QtPrivate::QSlotObjectBase::call qobjectdefs_impl.h 461 
0x7fffe5107b62
        46 doActivate<false> qobject.cpp 4284 0x7fffe533000f
        47 QMetaObject::activate qobject.cpp 4344 0x7fffe5326163
        48 QMetaObject::activate<void, QString> qobjectdefs.h 319 0x7fffe32b9abb
        49 QComboBox::currentTextChanged moc_qcombobox.cpp 374 0x7fffe3471721
        50 QComboBoxPrivate::updateCurrentText qcombobox.cpp 2963 0x7fffe346eb8d
        51 QComboBoxPrivate::emitCurrentIndexChanged qcombobox.cpp 1459 
0x7fffe346ee6e
        52 QComboBoxPrivate::setCurrentIndex qcombobox.cpp 2244 0x7fffe3469e7b
        53 QComboBox::setCurrentIndex qcombobox.cpp 2191 0x7fffe34692aa
        54 QtInstanceComboBox::set_active(int)::$_0::operator()() const 
QtInstanceComboBox.cxx 124 0x7fffe6266952
        55 std::__invoke_impl<void, 
QtInstanceComboBox::set_active(int)::$_0&>(std::__invoke_other, 
QtInstanceComboBox::set_active(int)::$_0&) invoke.h 61 0x7fffe6266925
        56 std::__invoke_r<void, 
QtInstanceComboBox::set_active(int)::$_0&>(QtInstanceComboBox::set_active(int)::$_0&)
 invoke.h 111 0x7fffe62668d5
        57 std::_Function_handler<void(), 
QtInstanceComboBox::set_active(int)::$_0>::_M_invoke std_function.h 290 
0x7fffe62667ed
        58 std::function<void()>::operator() std_function.h 591 0x7fffe621323e
        59 QtInstance::RunInMainThread QtInstance.cxx 205 0x7fffe620a3df
        60 QtInstanceComboBox::set_active QtInstanceComboBox.cxx 124 
0x7fffe6262269
        61 PlaceEditDialog::InitDetails PlaceEditDialog.cxx 234 0x7ffff09a65e0
        62 PlaceEditDialog::PlaceEditDialog PlaceEditDialog.cxx 73 
0x7ffff09a5398
        63 RemoteFilesDialog::AddService RemoteFilesDialog.cxx 510 
0x7fffa8331b2e
        64 RemoteFilesDialog::EditServiceMenuHdl RemoteFilesDialog.cxx 698 
0x7fffa833331d
        65 RemoteFilesDialog::LinkStubEditServiceMenuHdl RemoteFilesDialog.cxx 
565 0x7fffa832f28d
        66 Link<rtl::OUString const&, void>::Call link.hxx 105 0x7fffeebe4d91
        67 weld::MenuButton::signal_selected weld.hxx 1633 0x7fffeebe5571
        68 SalInstanceMenuButton::MenuSelectHdl salvtables.cxx 3077 
0x7fffeebb88af
        69 SalInstanceMenuButton::LinkStubMenuSelectHdl salvtables.cxx 3075 
0x7fffeebb783d
        70 Link<MenuButton *, void>::Call link.hxx 105 0x7fffee585ba1
        71 MenuButton::Select MenuButton.cxx 242 0x7fffee58449b
        72 MenuButton::ExecuteMenu MenuButton.cxx 105 0x7fffee584206
        73 MenuButton::MouseButtonDown MenuButton.cxx 213 0x7fffee585196
        74 ImplHandleMouseEvent winproc.cxx 733 0x7fffee48aad1
        75 ImplHandleSalMouseButtonDown winproc.cxx 2365 0x7fffee48f081
        76 ImplWindowFrameProc winproc.cxx 2710 0x7fffee48dcf1
        77 SalFrame::CallCallback salframe.hxx 310 0x7fffe61eb4fc
        78 QtFrame::CallCallback QtFrame.hxx 234 0x7fffe61e8715
        79 QtWidget::handleMouseButtonEvent QtWidget.cxx 112 0x7fffe633c09a
        80 QtWidget::mousePressEvent QtWidget.cxx 117 0x7fffe633c0ee
        81 QWidget::event qwidget.cpp 9005 0x7fffe32a7691
        82 QtWidget::event QtWidget.cxx 504 0x7fffe633ddfa
        83 QApplicationPrivate::notify_helper qapplication.cpp 3307 
0x7fffe31e6130
        84 QApplication::notify qapplication.cpp 2784 0x7fffe31e7df2
        85 QCoreApplication::notifyInternal2 qcoreapplication.cpp 1109 
0x7fffe5252ac9
        86 QCoreApplication::sendSpontaneousEvent qcoreapplication.cpp 1563 
0x7fffe52537c9
        87 QApplicationPrivate::sendMouseEvent qapplication.cpp 2365 
0x7fffe31e6a53
        88 QWidgetWindow::handleMouseEvent qwidgetwindow.cpp 683 0x7fffe32e780f
        89 QWidgetWindow::event qwidgetwindow.cpp 292 0x7fffe32e5e43
        90 QApplicationPrivate::notify_helper qapplication.cpp 3307 
0x7fffe31e6130
        91 QApplication::notify qapplication.cpp 3257 0x7fffe31ea038
        92 QCoreApplication::notifyInternal2 qcoreapplication.cpp 1109 
0x7fffe5252ac9
        93 QCoreApplication::sendSpontaneousEvent qcoreapplication.cpp 1563 
0x7fffe52537c9
        94 QGuiApplicationPrivate::processMouseEvent qguiapplication.cpp 2470 
0x7fffe4094437
        95 QGuiApplicationPrivate::processWindowSystemEvent qguiapplication.cpp 
2194 0x7fffe4093586
        96 QWindowSystemInterface::sendWindowSystemEvents 
qwindowsysteminterface.cpp 1117 0x7fffe417c75d
        97 QWindowSystemInterface::flushWindowSystemEvents 
qwindowsysteminterface.cpp 1086 0x7fffe417c60e
        98 QtWaylandClient::QWaylandDisplay::flushRequests qwaylanddisplay.cpp 
523 0x7fffdf0b5685
        99 QtPrivate::FunctorCall<std::integer_sequence<unsigned long>, 
QtPrivate::List<>, void, void (QtWaylandClient::QWaylandDisplay:: 
*)()>::call(void (QtWaylandClient::QWaylandDisplay:: *)(), 
QtWaylandClient::QWaylandDisplay *, void * *)::{lambda()#1}::operator()() const 
qobjectdefs_impl.h 127 0x7fffdf0d1995
        100 QtPrivate::FunctorCallBase::call_internal<void, 
QtPrivate::FunctorCall<std::integer_sequence<unsigned long>, QtPrivate::List<>, 
void, void (QtWaylandClient::QWaylandDisplay:: *)()>::call(void 
(QtWaylandClient::QWaylandDisplay:: *)(), QtWaylandClient::QWaylandDisplay *, 
void * *)::{lambda()#1}>(void * *, 
QtPrivate::FunctorCall<std::integer_sequence<unsigned long>, QtPrivate::List<>, 
void, void (QtWaylandClient::QWaylandDisplay:: *)()>::call(void 
(QtWaylandClient::QWaylandDisplay:: *)(), QtWaylandClient::QWaylandDisplay *, 
void * *)::{lambda()#1}&&) qobjectdefs_impl.h 65 0x7fffdf0d18bd
        101 QtPrivate::FunctorCall<std::integer_sequence<unsigned long>, 
QtPrivate::List<>, void, void (QtWaylandClient::QWaylandDisplay:: 
*)()>::call(void (QtWaylandClient::QWaylandDisplay:: *)(), 
QtWaylandClient::QWaylandDisplay *, void * *) qobjectdefs_impl.h 126 
0x7fffdf0d17df
        102 QtPrivate::FunctionPointer<void (QtWaylandClient::QWaylandDisplay:: 
*)()>::call<QtPrivate::List<>, void>(void (QtWaylandClient::QWaylandDisplay:: 
*)(), QtWaylandClient::QWaylandDisplay *, void * *) qobjectdefs_impl.h 174 
0x7fffdf0d1751
        103 QtPrivate::QCallableObject<void (QtWaylandClient::QWaylandDisplay:: 
*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject 
*, void * *, bool *) qobjectdefs_impl.h 545 0x7fffdf0d167b
        104 QtPrivate::QSlotObjectBase::call qobjectdefs_impl.h 461 
0x7fffe5107b62
        105 QMetaCallEvent::placeMetaCall qobject.cpp 544 0x7fffe531a02c
        106 QObject::event qobject.cpp 1465 0x7fffe531c1c1
        107 QApplicationPrivate::notify_helper qapplication.cpp 3307 
0x7fffe31e6130
        108 QApplication::notify qapplication.cpp 3257 0x7fffe31ea038
        109 QCoreApplication::notifyInternal2 qcoreapplication.cpp 1109 
0x7fffe5252ac9
        110 QCoreApplication::sendEvent qcoreapplication.cpp 1549 0x7fffe5253739
        111 QCoreApplicationPrivate::sendPostedEvents qcoreapplication.cpp 1904 
0x7fffe525466a
        112 QCoreApplication::sendPostedEvents qcoreapplication.cpp 1757 
0x7fffe525357c
        113 postEventSourceDispatch qeventdispatcher_glib.cpp 246 0x7fffe585bba1
        114 ?? 0x7fffe99043c5
        115 ?? 0x7fffe99065f7
        116 g_main_context_iteration 0x7fffe9906d60
        117 QEventDispatcherGlib::processEvents qeventdispatcher_glib.cpp 399 
0x7fffe585addb
        118 QPAEventDispatcherGlib::processEvents qeventdispatcher_glib.cpp 89 
0x7fffe499f838
        119 QtInstance::ImplYield QtInstance.cxx 501 0x7fffe6209c42
        120 QtInstance::DoYield QtInstance.cxx 512 0x7fffe620cf81
        121 ImplYield svapp.cxx 385 0x7fffeec5e3c6
        122 Application::Yield svapp.cxx 488 0x7fffeec5dcdf
        123 Dialog::Execute dialog.cxx 1095 0x7fffee2cff7b
        124 SalInstanceDialog::run salvtables.cxx 1865 0x7fffeebade7e
        125 weld::DialogController::run weld.hxx 2879 0x7fffa82c8cbe
        126 RemoteFilesDialog::run RemoteFilesDialog.cxx 188 0x7fffa83303ab
        127 SvtFilePicker::implExecutePicker OfficeFilePicker.cxx 423 
0x7fffa8312a5a
        128 svt::OCommonPicker::execute commonpicker.cxx 354 0x7fffa829fab9
        129 SvtFilePicker::execute OfficeFilePicker.cxx 453 0x7fffa8312c35
        130 sfx2::FileDialogHelper_Impl::implDoExecute filedlghelper.cxx 1377 
0x7ffff3d4d4f4
        131 sfx2::FileDialogHelper_Impl::execute filedlghelper.cxx 1466 
0x7ffff3d4e278
        132 sfx2::FileDialogHelper::Execute filedlghelper.cxx 2632 
0x7ffff3d549c4
        133 sfx2::FileOpenDialog_Impl filedlghelper.cxx 2858 0x7ffff3d55c10
        134 SfxApplication::OpenDocExec_Impl appopen.cxx 655 0x7ffff3a85994
        135 SfxStubSfxApplicationOpenDocExec_Impl sfxslots.hxx 1303 
0x7ffff3a7db95
        136 SfxDispatcher::Call_Impl dispatch.cxx 256 0x7ffff3bd55fe
        137 SfxDispatcher::Execute_ dispatch.cxx 755 0x7ffff3bd9ea6
        138 SfxDispatcher::Execute dispatch.cxx 901 0x7ffff3bdaa88
        139 SfxApplication::OpenRemoteExec_Impl appopen.cxx 1160 0x7ffff3a8a165
        140 SfxStubSfxApplicationOpenRemoteExec_Impl sfxslots.hxx 1304 
0x7ffff3a7dbc5
        141 SfxDispatcher::Call_Impl dispatch.cxx 256 0x7ffff3bd55fe
        142 SfxDispatcher::PostMsgHandler dispatch.cxx 997 0x7ffff3bdb1a6
        143 SfxHintPoster::DoEvent_Impl hintpost.cxx 74 0x7ffff40d89f8
        144 SfxHintPoster::LinkStubDoEvent_Impl hintpost.cxx 54 0x7ffff40d893d
        145 Link<void *, void>::Call link.hxx 105 0x7fffee495f51
        146 ImplHandleUserEvent winproc.cxx 2312 0x7fffee491811
        147 ImplWindowFrameProc winproc.cxx 2876 0x7fffee48e73f
        148 SalFrame::CallCallback salframe.hxx 310 0x7fffe61eb4fc
        149 QtInstance::ProcessEvent QtInstance.cxx 594 0x7fffe620d3bf
        150 SalUserEventList::DispatchUserEvents(bool)::$_0::operator()() const 
salusereventlist.cxx 119 0x7fffeeb92fad
        151 SalUserEventList::DispatchUserEvents salusereventlist.cxx 120 
0x7fffeeb92e7b
        152 QtInstance::ImplYield QtInstance.cxx 490 0x7fffe6209ba1
        153 QtInstance::DoYield QtInstance.cxx 512 0x7fffe620cf81
        154 ImplYield svapp.cxx 385 0x7fffeec5e3c6
        155 Application::Yield svapp.cxx 488 0x7fffeec5dcdf
        156 Application::Execute svapp.cxx 360 0x7fffeec5dac0
        157 desktop::Desktop::Main app.cxx 1678 0x7ffff7b290b5
        158 ImplSVMain svmain.cxx 230 0x7fffeec8a2e6
        159 SVMain svmain.cxx 248 0x7fffeec8bdd9
        160 soffice_main sofficemain.cxx 122 0x7ffff7ba2d6a
        161 sal_main main.c 51 0x5555555559fd
        162 main main.c 49 0x5555555559d7
    
    Change-Id: I8cb764c31763b61469f30397e8efc0ff96456746
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188775
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/svtools/source/dialogs/PlaceEditDialog.cxx 
b/svtools/source/dialogs/PlaceEditDialog.cxx
index b6231c1530d8..c901385921d3 100644
--- a/svtools/source/dialogs/PlaceEditDialog.cxx
+++ b/svtools/source/dialogs/PlaceEditDialog.cxx
@@ -349,6 +349,8 @@ void PlaceEditDialog::SelectType(bool bSkipSeparator)
         m_xCurrentDetails->set_visible(false);
 
     const int nPos = m_xLBServerType->get_active( );
+    if (nPos < 0)
+        return;
     m_xCurrentDetails = m_aDetailsContainers[nPos];
     m_nCurrentType = nPos;
 
commit 992b46a623751ad3d139ceff5256701f0727d3c0
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Aug 1 14:47:01 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sat Aug 2 09:16:08 2025 +0200

    tdf#130857 qt weld: Notify about ScrolledWindow scroll value changes
    
    Change-Id: I0810299902d7bd5eb97296036d2bd19f35ac304e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188770
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/inc/qt5/QtInstanceScrolledWindow.hxx 
b/vcl/inc/qt5/QtInstanceScrolledWindow.hxx
index 3c8ce14613b0..8312cf72a937 100644
--- a/vcl/inc/qt5/QtInstanceScrolledWindow.hxx
+++ b/vcl/inc/qt5/QtInstanceScrolledWindow.hxx
@@ -57,6 +57,10 @@ public:
 private:
     static Qt::ScrollBarPolicy toQtPolicy(VclPolicyType eVclPolicy);
     static VclPolicyType toVclPolicy(Qt::ScrollBarPolicy eQtPolicy);
+
+private Q_SLOTS:
+    void handleHorizontalScrollValueChanged();
+    void handleVerticalScrollValueChanged();
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/vcl/qt5/QtInstanceScrolledWindow.cxx 
b/vcl/qt5/QtInstanceScrolledWindow.cxx
index a00904319a39..a9f848cdc49b 100644
--- a/vcl/qt5/QtInstanceScrolledWindow.cxx
+++ b/vcl/qt5/QtInstanceScrolledWindow.cxx
@@ -17,6 +17,14 @@ 
QtInstanceScrolledWindow::QtInstanceScrolledWindow(QScrollArea* pScrollArea)
     , m_pScrollArea(pScrollArea)
 {
     assert(m_pScrollArea);
+
+    if (QScrollBar* pHorizontalScrollBar = 
m_pScrollArea->horizontalScrollBar())
+        connect(pHorizontalScrollBar, &QScrollBar::valueChanged, this,
+                &QtInstanceScrolledWindow::handleHorizontalScrollValueChanged);
+
+    if (QScrollBar* pVerticalScrollBar = m_pScrollArea->verticalScrollBar())
+        connect(pVerticalScrollBar, &QScrollBar::valueChanged, this,
+                &QtInstanceScrolledWindow::handleVerticalScrollValueChanged);
 }
 
 void QtInstanceScrolledWindow::hadjustment_configure(int nValue, int nUpper, 
int nStepIncrement,
@@ -337,4 +345,16 @@ VclPolicyType 
QtInstanceScrolledWindow::toVclPolicy(Qt::ScrollBarPolicy eQtPolic
     }
 }
 
+void QtInstanceScrolledWindow::handleHorizontalScrollValueChanged()
+{
+    SolarMutexGuard aGuard;
+    signal_hadjustment_value_changed();
+}
+
+void QtInstanceScrolledWindow::handleVerticalScrollValueChanged()
+{
+    SolarMutexGuard aGuard;
+    signal_vadjustment_value_changed();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */

Reply via email to