From b666aa58d7a168fe4ddb694caba099343421aa65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 4 Sep 2015 12:25:56 +0200 Subject: 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 --- src/qtwaylandscanner/qtwaylandscanner.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/qtwaylandscanner') diff --git a/src/qtwaylandscanner/qtwaylandscanner.cpp b/src/qtwaylandscanner/qtwaylandscanner.cpp index 78873c714..6d602ad08 100644 --- a/src/qtwaylandscanner/qtwaylandscanner.cpp +++ b/src/qtwaylandscanner/qtwaylandscanner.cpp @@ -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? printf(" %s::Resource *%s::bind(struct ::wl_client *client, uint32_t id, int version)\n", interfaceName, interfaceName); 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->%s_object = this;\n", interfaceNameStripped); printf("\n"); -- cgit v1.2.3