QCocoaFileDialogHelper: protect more against dangling pointers

This is in addition to 10b5b4cbba79416e69c8b4ceea4874a9af26a237,
where we made m_helper QPointer to make sure it was still valid
before accessing it. There is one more place in completionHandler
where we need the same check.

Fixes: QTBUG-131880
Pick-to: 6.5
Change-Id: Id51d2c68db23b897b145ad25dd1c73b3f5eb9cc1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit a794f957c4c17fbcb12a4b78f58240d109c150d5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Vladimir Belyavsky 2024-12-04 15:03:40 +03:00 committed by Qt Cherry-pick Bot
parent fad01d6a04
commit 497cc1deb8

View File

@ -164,7 +164,10 @@ typedef QSharedPointer<QFileDialogOptions> SharedPointerFileDialogOptions;
[self updateProperties];
auto completionHandler = ^(NSInteger result) { m_helper->panelClosed(result); };
auto completionHandler = ^(NSInteger result) {
if (m_helper)
m_helper->panelClosed(result);
};
if (windowModality == Qt::WindowModal && parent) {
NSView *view = reinterpret_cast<NSView*>(parent->winId());