qtwaylandscanner: Handle destructor requests with new_id correctly
Instead of generating code like return request(args) m_object = nullptr do new_id = request(args) m_object = nullptr return new_id This came up in the color managment protocol where wp_image_description_creator_params_v1::create creates a new object but is also a destructor at the same time. Pick-to: 6.9 Change-Id: Ic5d9f72656d99740bf6665c07393f69ee78af013 Reviewed-by: David Redondo <qt@david-redondo.de>
This commit is contained in:
parent
555bda1736
commit
deec49bac6
@ -1214,7 +1214,10 @@ bool Scanner::process()
|
||||
printf("\n");
|
||||
}
|
||||
int actualArgumentCount = new_id ? int(e.arguments.size()) - 1 : int(e.arguments.size());
|
||||
printf(" %s::%s_%s(\n", new_id ? "return " : "", interfaceName, e.name.constData());
|
||||
if (new_id)
|
||||
printf(" %s %s = ::%s_%s(\n", new_id_str.constData(), new_id->name.constData(), interfaceName, e.name.constData());
|
||||
else
|
||||
printf(" ::%s_%s(\n", interfaceName, e.name.constData());
|
||||
printf(" m_%s%s", interfaceName, actualArgumentCount > 0 ? "," : "");
|
||||
bool needsComma = false;
|
||||
for (const WaylandArgument &a : e.arguments) {
|
||||
@ -1245,6 +1248,8 @@ bool Scanner::process()
|
||||
printf(");\n");
|
||||
if (e.type == "destructor")
|
||||
printf(" m_%s = nullptr;\n", interfaceName);
|
||||
if (new_id)
|
||||
printf(" return %s;\n", new_id->name.constData());
|
||||
printf(" }\n");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user