summaryrefslogtreecommitdiffstats
path: root/modules/mono/mono_gd/gd_mono_property.cpp
diff options
context:
space:
mode:
authorIgnacio Etcheverry <neikeq@users.noreply.github.com>2018-07-31 20:10:04 +0200
committerGitHub <noreply@github.com>2018-07-31 20:10:04 +0200
commitccce161d0e8b03cb7abc3186e920547d6914ef56 (patch)
tree8d061eddc8c874b7fe8879c0f64ecd2ed348b0d7 /modules/mono/mono_gd/gd_mono_property.cpp
parent3f01f40e91c962b68fd18c0ca00144dfb6aee65f (diff)
parent4172fa03b56bb60fe096639585e0ca40df73b677 (diff)
downloadredot-engine-ccce161d0e8b03cb7abc3186e920547d6914ef56.tar.gz
Merge pull request #20639 from neikeq/issue-20531-and-cleanup
Mono: Fix property set_value and cleanup
Diffstat (limited to 'modules/mono/mono_gd/gd_mono_property.cpp')
-rw-r--r--modules/mono/mono_gd/gd_mono_property.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/modules/mono/mono_gd/gd_mono_property.cpp b/modules/mono/mono_gd/gd_mono_property.cpp
index a1c710c26c..ce66e0c8db 100644
--- a/modules/mono/mono_gd/gd_mono_property.cpp
+++ b/modules/mono/mono_gd/gd_mono_property.cpp
@@ -139,15 +139,23 @@ bool GDMonoProperty::has_setter() {
}
void GDMonoProperty::set_value(MonoObject *p_object, MonoObject *p_value, MonoException **r_exc) {
- void *params[1] = { p_value };
- set_value(p_object, params, r_exc);
+ MonoMethod *prop_method = mono_property_get_set_method(mono_property);
+ MonoArray *params = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(MonoObject), 1);
+ mono_array_set(params, MonoObject *, 0, p_value);
+ MonoException *exc = NULL;
+ GDMonoUtils::runtime_invoke_array(prop_method, p_object, params, &exc);
+ if (exc) {
+ if (r_exc) {
+ *r_exc = exc;
+ } else {
+ GDMonoUtils::set_pending_exception(exc);
+ }
+ }
}
void GDMonoProperty::set_value(MonoObject *p_object, void **p_params, MonoException **r_exc) {
MonoException *exc = NULL;
- GD_MONO_BEGIN_RUNTIME_INVOKE;
- mono_property_set_value(mono_property, p_object, p_params, (MonoObject **)&exc);
- GD_MONO_END_RUNTIME_INVOKE;
+ GDMonoUtils::property_set_value(mono_property, p_object, p_params, &exc);
if (exc) {
if (r_exc) {
@@ -160,9 +168,7 @@ void GDMonoProperty::set_value(MonoObject *p_object, void **p_params, MonoExcept
MonoObject *GDMonoProperty::get_value(MonoObject *p_object, MonoException **r_exc) {
MonoException *exc = NULL;
- GD_MONO_BEGIN_RUNTIME_INVOKE;
- MonoObject *ret = mono_property_get_value(mono_property, p_object, NULL, (MonoObject **)&exc);
- GD_MONO_END_RUNTIME_INVOKE;
+ MonoObject *ret = GDMonoUtils::property_get_value(mono_property, p_object, NULL, &exc);
if (exc) {
ret = NULL;