diff options
author | Philip Chimento <philip.chimento@gmail.com> | 2021-08-26 04:32:36 +0000 |
---|---|---|
committer | Philip Chimento <philip.chimento@gmail.com> | 2021-08-26 04:32:36 +0000 |
commit | ed1a149430970adc43d1f3d1239b3f48b073a472 (patch) | |
tree | 46256dd1ca4bb8cf92851ddc37af41cc5f6bc796 | |
parent | 82da2ef63509545dd78ed1b3132767d8bb9c29cc (diff) | |
parent | d827c1505908ac94c1100b5a0b604d9a56f2aa15 (diff) | |
download | gjs-ed1a149430970adc43d1f3d1239b3f48b073a472.tar.gz |
Merge branch 'ewlsh/return-null-for-pointers' into 'master'
gi: Return null if return argument is a pointer type
See merge request GNOME/gjs!659
-rw-r--r-- | gi/arg.cpp | 7 | ||||
-rw-r--r-- | installed-tests/js/testGIMarshalling.js | 4 |
2 files changed, 8 insertions, 3 deletions
@@ -2431,7 +2431,12 @@ gjs_value_from_g_argument (JSContext *context, switch (type_tag) { case GI_TYPE_TAG_VOID: - value_p.setUndefined(); /* or .setNull() ? */ + // If the argument is a pointer, convert to null to match our + // in handling. + if (g_type_info_is_pointer(type_info)) + value_p.setNull(); + else + value_p.setUndefined(); break; case GI_TYPE_TAG_BOOLEAN: diff --git a/installed-tests/js/testGIMarshalling.js b/installed-tests/js/testGIMarshalling.js index 27e05c8a..5958605d 100644 --- a/installed-tests/js/testGIMarshalling.js +++ b/installed-tests/js/testGIMarshalling.js @@ -920,9 +920,9 @@ describe('Raw pointers', function () { expect(GIMarshallingTests.pointer_in_return(null)).toBeFalsy(); }); - xit('can be roundtripped at least if the pointer is null', function () { + it('can be roundtripped at least if the pointer is null', function () { expect(GIMarshallingTests.pointer_in_return(null)).toBeNull(); - }).pend('https://gitlab.gnome.org/GNOME/gjs/merge_requests/46'); + }); }); describe('Registered enum type', function () { |