Fix Object::notification order

Previously the `p_reversed` parameter didn't influence the order
in a correct way.
Also script overridden _notification functions were not called in
the correct order.

To fix this some `notification` functions had to add a `p_reversed`
parameter.

This made it necessary to adjust cpp-bindings.

Co-authored-by: David Snopek <dsnopek@gmail.com>
This commit is contained in:
Markus Sauermann 2023-06-24 03:07:22 +02:00
parent 247c3548d8
commit c4705a590b
14 changed files with 314 additions and 28 deletions

View file

@ -1978,7 +1978,7 @@ const Variant CSharpInstance::get_rpc_config() const {
return script->get_rpc_config();
}
void CSharpInstance::notification(int p_notification) {
void CSharpInstance::notification(int p_notification, bool p_reversed) {
if (p_notification == Object::NOTIFICATION_PREDELETE) {
// When NOTIFICATION_PREDELETE is sent, we also take the chance to call Dispose().
// It's safe to call Dispose() multiple times and NOTIFICATION_PREDELETE is guaranteed
@ -1996,7 +1996,7 @@ void CSharpInstance::notification(int p_notification) {
return;
}
_call_notification(p_notification);
_call_notification(p_notification, p_reversed);
GDMonoCache::managed_callbacks.CSharpInstanceBridge_CallDispose(
gchandle.get_intptr(), /* okIfNull */ false);
@ -2004,10 +2004,10 @@ void CSharpInstance::notification(int p_notification) {
return;
}
_call_notification(p_notification);
_call_notification(p_notification, p_reversed);
}
void CSharpInstance::_call_notification(int p_notification) {
void CSharpInstance::_call_notification(int p_notification, bool p_reversed) {
Variant arg = p_notification;
const Variant *args[1] = { &arg };
StringName method_name = SNAME("_notification");