Call parent constructors. Todo: I need to figure out how godot manages to get away without doing this.

This commit is contained in:
Relintai 2021-08-21 16:39:38 +02:00
parent a8cb81598b
commit 464576468b
2 changed files with 10 additions and 8 deletions

View File

@ -30,7 +30,8 @@ bool Reference::unreference() {
return die; return die;
} }
Reference::Reference() { Reference::Reference() :
Object() {
refcount.init(); refcount.init();
refcount_init.init(); refcount_init.init();
} }

View File

@ -68,13 +68,13 @@ typedef std::vector<Ref<Resource> > ResourceVector;
\ \
return pp->setter(this, data); return pp->setter(this, data);
#define RESOURCE_PROPERTY_ADD_IMPL(property_type, type_enum) \ #define RESOURCE_PROPERTY_ADD_IMPL(property_type, type_enum) \
ResourceProperty<std::function<property_type(Resource *)>, std::function<void(Resource *, property_type)> > *prop = new ResourceProperty<std::function<property_type(Resource *)>, std::function<void(Resource *, property_type)> >(); \ ResourceProperty<std::function<property_type(Resource *)>, std::function<void(Resource *, property_type)> > *prop = new ResourceProperty<std::function<property_type(Resource *)>, std::function<void(Resource *, property_type)> >(); \
\ \
prop->type = type_enum; \ prop->type = type_enum; \
prop->getter = getter; \ prop->getter = getter; \
prop->setter = setter; \ prop->setter = setter; \
\ \
_property_map[name] = prop; _property_map[name] = prop;
//Properties stuff end //Properties stuff end
@ -291,7 +291,8 @@ Resource::Resource() {
register_properties(); register_properties();
} }
Resource::~Resource() { Resource::~Resource() :
Reference() {
std::map<std::string, ResourcePropertyBase *>::iterator it; std::map<std::string, ResourcePropertyBase *>::iterator it;
for (it = _property_map.begin(); it != _property_map.end(); it++) { for (it = _property_map.begin(); it != _property_map.end(); it++) {