Skip to content

Commit a246aaa

Browse files
committed
Fix NOTIFICATION_POSTINITIALIZE sent twice to native parent class
(cherry picked from commit 06373ce)
1 parent e8e424a commit a246aaa

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

include/godot_cpp/classes/wrapped.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ class Wrapped {
8888
::godot::List<::godot::PropertyInfo> plist_owned;
8989

9090
void _postinitialize();
91+
virtual void _notificationv(int32_t p_what, bool p_reversed = false) {}
9192

9293
Wrapped(const StringName p_godot_class);
9394
Wrapped(GodotObject *p_godot_object);
@@ -353,6 +354,11 @@ public:
353354
_gde_binding_reference_callback, \
354355
}; \
355356
\
357+
protected: \
358+
virtual void _notificationv(int32_t p_what, bool p_reversed = false) override { \
359+
m_class::notification_bind(this, p_what, p_reversed); \
360+
} \
361+
\
356362
private:
357363

358364
// Don't use this for your classes, use GDCLASS() instead.

src/classes/wrapped.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,7 @@ void Wrapped::_postinitialize() {
5151
}
5252
godot::internal::gdextension_interface_object_set_instance_binding(_owner, godot::internal::token, this, _get_bindings_callbacks());
5353
if (extension_class) {
54-
Object *obj = dynamic_cast<Object *>(this);
55-
if (obj) {
56-
obj->notification(Object::NOTIFICATION_POSTINITIALIZE);
57-
}
54+
_notificationv(Object::NOTIFICATION_POSTINITIALIZE);
5855
}
5956
}
6057

0 commit comments

Comments
 (0)