From b061dc41f62048acd4a34c6570c0ea396cd9d0b4 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 3 Dec 2013 16:41:59 +0100 Subject: qom: Do not register interface "types" in the type table and fix names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There should be no need to look up nor enumerate the interface "types", whose "classes" are really just vtables. Just create the types and add them to the interface list of the parent type. Interfaces not registering their type anymore means that accessing superclass::interface by type name will fail when initializing subclass::interface. Thus, we need to pre-initialize the subclass's parent_type field before calling type_initialize. Apart from this, the interface "types" should never be used and thus it is harmless to leave them out of the hashtable. Further, the interface types had a bug with interfaces that are inherited from a superclass: The implementation type name was wrong (for example it was subclass::superclass::interface rather than just subclass::interface). This patch fixes this as well. Reported-by: Igor Mammedov Tested-by: Igor Mammedov Signed-off-by: Paolo Bonzini Signed-off-by: Andreas Färber --- include/qom/object.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/qom') diff --git a/include/qom/object.h b/include/qom/object.h index 5f78847d68..e0ff212cb6 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -536,6 +536,7 @@ struct InterfaceClass ObjectClass parent_class; /*< private >*/ ObjectClass *concrete_class; + Type interface_type; }; #define TYPE_INTERFACE "interface" -- cgit v1.2.1