Fix crash on qdbus when return type is a raw dbus type
Assigning a -1 to type is going to make things crash since it basically means unresolved and when you try to access the string data go to a index that doesn't exist So what I do is save the return type in rawReturnType if it is a raw one and reassign the type to IsUnresolvedType | strings.enter(mm.rawReturnType) instead of -1 when "saving" the metaobject Task-number: QTBUG-32671 Change-Id: I67898dea8a1926eee80c16417e877ef4e22aa06b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
f52e9b1172
commit
5d192deed9
@ -75,6 +75,7 @@ private:
|
||||
QByteArray name;
|
||||
QVarLengthArray<int, 4> inputTypes;
|
||||
QVarLengthArray<int, 4> outputTypes;
|
||||
QByteArray rawReturnType;
|
||||
int flags;
|
||||
};
|
||||
|
||||
@ -276,6 +277,9 @@ void QDBusMetaObjectGenerator::parseMethods()
|
||||
|
||||
mm.outputTypes.append(type.id);
|
||||
|
||||
if (i == 0 && type.id == -1) {
|
||||
mm.rawReturnType = type.name;
|
||||
}
|
||||
if (i != 0) {
|
||||
// non-const ref parameter
|
||||
mm.parameterNames.append(arg.name.toLatin1());
|
||||
@ -471,10 +475,14 @@ void QDBusMetaObjectGenerator::write(QDBusMetaObject *obj)
|
||||
int type;
|
||||
QByteArray typeName;
|
||||
if (i < 0) { // Return type
|
||||
if (!mm.outputTypes.isEmpty())
|
||||
if (!mm.outputTypes.isEmpty()) {
|
||||
type = mm.outputTypes.first();
|
||||
else
|
||||
if (type == -1) {
|
||||
type = IsUnresolvedType | strings.enter(mm.rawReturnType);
|
||||
}
|
||||
} else {
|
||||
type = QMetaType::Void;
|
||||
}
|
||||
} else if (i < mm.inputTypes.size()) {
|
||||
type = mm.inputTypes.at(i);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user