aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken2/generator/shiboken2/cppgenerator.cpp')
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
index 9df0d61c5..76f902c07 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
@@ -448,6 +448,7 @@ void CppGenerator::generateClass(QTextStream &s, GeneratorContext &classContext)
for (FunctionGroupMapIt it = functionGroups.cbegin(), end = functionGroups.cend(); it != end; ++it) {
AbstractMetaFunctionList overloads;
QSet<QString> seenSignatures;
+ bool staticEncountered = false;
for (AbstractMetaFunction *func : it.value()) {
if (!func->isAssignmentOperator()
&& !func->usesRValueReferences()
@@ -460,6 +461,19 @@ void CppGenerator::generateClass(QTextStream &s, GeneratorContext &classContext)
// But when a function is both in a class and inherited in a subclass,
// then we need to search through all subclasses and collect the new signatures.
overloads << getFunctionAndInheritedOverloads(func, &seenSignatures);
+ if (func->isStatic())
+ staticEncountered = true;
+ }
+ }
+ // PYSIDE-886: If the method does not have any static overloads declared
+ // in the class in question, remove all inherited static methods as setting
+ // METH_STATIC in that case can cause crashes for the instance methods.
+ // Manifested as crash when calling QPlainTextEdit::find() (clash with
+ // static QWidget::find(WId)).
+ if (!staticEncountered) {
+ for (int i = overloads.size() - 1; i >= 0; --i) {
+ if (overloads.at(i)->isStatic())
+ delete overloads.takeAt(i);
}
}