aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/PySide6/glue/qtnetworkauth.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside6/PySide6/glue/qtnetworkauth.cpp')
-rw-r--r--sources/pyside6/PySide6/glue/qtnetworkauth.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/sources/pyside6/PySide6/glue/qtnetworkauth.cpp b/sources/pyside6/PySide6/glue/qtnetworkauth.cpp
index f390605d2..9963bfbee 100644
--- a/sources/pyside6/PySide6/glue/qtnetworkauth.cpp
+++ b/sources/pyside6/PySide6/glue/qtnetworkauth.cpp
@@ -1,10 +1,19 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
-// @snippet qabstractoauth-setmodifyparametersfunction
-auto callable = %PYARG_1;
-auto callback = [callable](QAbstractOAuth::Stage stage, QMultiMap<QString, QVariant>* dictPointer) -> void
+// @snippet qabstractoauth-lookuphost-functor
+struct QAbstractOAuthModifyFunctor : public Shiboken::PyObjectHolder
+{
+public:
+ using Shiboken::PyObjectHolder::PyObjectHolder;
+
+ void operator()(QAbstractOAuth::Stage stage, QMultiMap<QString, QVariant>* dictPointer);
+};
+
+void QAbstractOAuthModifyFunctor::operator()(QAbstractOAuth::Stage stage,
+ QMultiMap<QString, QVariant>* dictPointer)
{
+ auto *callable = object();
if (!PyCallable_Check(callable)) {
qWarning("Argument 1 of %FUNCTION_NAME must be a callable.");
return;
@@ -26,12 +35,10 @@ auto callback = [callable](QAbstractOAuth::Stage stage, QMultiMap<QString, QVari
dictPointer->replace(cppKey, cppValue);
}
}
+}
+// @snippet qabstractoauth-lookuphost-functor
- Py_DECREF(callable);
- return;
-
-};
-Py_INCREF(callable);
-%CPPSELF.%FUNCTION_NAME(callback);
+// @snippet qabstractoauth-setmodifyparametersfunction
+%CPPSELF.%FUNCTION_NAME(QAbstractOAuthModifyFunctor(%PYARG_1));
// @snippet qabstractoauth-setmodifyparametersfunction