vcl/inc/qt5/QtInstanceMessageDialog.hxx | 2 ++ vcl/qt5/QtInstanceMessageDialog.cxx | 8 ++++++++ 2 files changed, 10 insertions(+)
New commits: commit 573f21a6383cec270a9d25dfafb87a8241cbc5de Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Tue Aug 6 15:19:21 2024 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Wed Aug 7 07:09:39 2024 +0200 tdf#162351 tdf#130857 qt weld: Implement weld_widget_for_response ... for `QtInstanceMessageDialog`. This fixes the crash reported in tdf#162351 due to a nullptr deref in `OSQLMessageBox::impl_addDetailsButton` that was seen with the base class implementation `QtInstanceDialog::weld_widget_for_response` that just returns nullptr. Clicking the "More" button in that dialog doesn't yet show the corresponding dialog, but that will be implemenated separately. Change-Id: I8cd4fac4fd57be993dba1713bb2e19860dfc334b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171551 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/vcl/inc/qt5/QtInstanceMessageDialog.hxx b/vcl/inc/qt5/QtInstanceMessageDialog.hxx index bc6971210e06..5c09d5090781 100644 --- a/vcl/inc/qt5/QtInstanceMessageDialog.hxx +++ b/vcl/inc/qt5/QtInstanceMessageDialog.hxx @@ -9,6 +9,7 @@ #pragma once +#include "QtInstanceButton.hxx" #include "QtInstanceDialog.hxx" #include <QtWidgets/QMessageBox> @@ -43,6 +44,7 @@ public: virtual void add_button(const OUString& rText, int nResponse, const OUString& rHelpId = {}) override; virtual void set_default_response(int nResponse) override; + QtInstanceButton* weld_widget_for_response(int nResponse) override; virtual int run() override; virtual bool runAsync(std::shared_ptr<weld::DialogController> const& rxOwner, const std::function<void(sal_Int32)>& func) override; diff --git a/vcl/qt5/QtInstanceMessageDialog.cxx b/vcl/qt5/QtInstanceMessageDialog.cxx index ec5761bca75a..b9e458c502ac 100644 --- a/vcl/qt5/QtInstanceMessageDialog.cxx +++ b/vcl/qt5/QtInstanceMessageDialog.cxx @@ -67,6 +67,14 @@ void QtInstanceMessageDialog::set_default_response(int nResponse) m_pMessageDialog->setDefaultButton(pButton); } +QtInstanceButton* QtInstanceMessageDialog::weld_widget_for_response(int nResponse) +{ + if (QPushButton* pButton = buttonForResponseCode(nResponse)) + return new QtInstanceButton(pButton); + + return nullptr; +} + int QtInstanceMessageDialog::run() { m_pMessageDialog->exec();