core: fix wrongly exporting object before instance is fully constructed

Exporting the object already in the *_init() function will later
break because the object is not yet fully initialized at that point.

Add a convenient flag so that the NMExportedObject parent implementation
automatically can export itself. This saves the derived class from
overwriting the constructed() method.

Also add an assertion to catch such bugs.
This commit is contained in:
Thomas Haller
2015-11-04 14:44:29 +01:00
parent ae5cfba05c
commit 8a8ecc46ca
4 changed files with 33 additions and 4 deletions

View File

@@ -40,6 +40,7 @@ typedef struct {
GObjectClass parent;
const char *export_path;
char export_on_construction;
} NMExportedObjectClass;
GType nm_exported_object_get_type (void);