Add an assert in QtWaylandScanner for duplicate binds
Since Q_SIGNALS are a one -> many distribution we can end up signalling creation requests to many slots. Its then important that we verify that only one of these actually binds an object for the object id. Its a programming error to have this situation, hence its an assert, and not a runtime check that gives a warning. The bind will overwrite the object and the last bind will continue to work as normal in release mode. Change-Id: I1f469066cf5287789249763843e6cbaa545ee619
This commit is contained in:
parent
6f3dc689d7
commit
7c93b46a03
@ -666,6 +666,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr
|
|||||||
//and use function overloading instead. Jan do you have a lot of code dependent on this behavior?
|
//and use function overloading instead. Jan do you have a lot of code dependent on this behavior?
|
||||||
printf(" %s::Resource *%s::bind(struct ::wl_client *client, uint32_t id, int version)\n", interfaceName, interfaceName);
|
printf(" %s::Resource *%s::bind(struct ::wl_client *client, uint32_t id, int version)\n", interfaceName, interfaceName);
|
||||||
printf(" {\n");
|
printf(" {\n");
|
||||||
|
printf(" Q_ASSERT_X(!wl_client_get_object(client, id), \"QWaylandObject bind\", QStringLiteral(\"binding to object %1 more than once\").arg(id).toLocal8Bit().constData());\n");
|
||||||
printf(" Resource *resource = %s_allocate();\n", interfaceNameStripped);
|
printf(" Resource *resource = %s_allocate();\n", interfaceNameStripped);
|
||||||
printf(" resource->%s_object = this;\n", interfaceNameStripped);
|
printf(" resource->%s_object = this;\n", interfaceNameStripped);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user