Skip to content

Commit

Permalink
Fix array of string properties.
Browse files Browse the repository at this point in the history
And probably other non-nullable array properties.

Tests already exists but the bug was hidden by the existence
of a setter method that was overwriting the buggy property setter
method.
  • Loading branch information
hugopl committed Jul 17, 2023
1 parent abcfba3 commit 22358e7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
1 change: 1 addition & 0 deletions ecr/property.ecr
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
def <%= to_call(prop.name) %>=(value : <%= prop_type_name %>) : <%= prop_type_name %>
<% if prop.type_info.array? -%>
# handle array
unsafe_value = value.to_a.map(&.to_unsafe).to_unsafe
<% else -%>
unsafe_value = value
<% end %>
Expand Down
2 changes: 2 additions & 0 deletions spec/libtest/test_subject.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ static void test_subject_iface_interface_init(TestIfaceInterface* iface) {
G_DEFINE_TYPE_WITH_CODE(TestSubject, test_subject, G_TYPE_OBJECT,
G_ADD_PRIVATE(TestSubject) G_IMPLEMENT_INTERFACE(TEST_TYPE_IFACE, test_subject_iface_interface_init))

void test_subject_set_str_list(TestSubject* self, const char** list);

typedef enum {
PROP_STRING = 1,
PROP_BOOLEAN,
Expand Down
8 changes: 0 additions & 8 deletions spec/libtest/test_subject.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,6 @@ void test_subject_set_simple_func(TestSubject* self, TestSubjectSimpleFunc func,
*/
gboolean test_subject_call_simple_func(TestSubject* self, int number);

/**
* test_subject_set_str_list:
* @list: (array zero-terminated=1):
*
* Setter for str_list property.
*/
void test_subject_set_str_list(TestSubject* self, const char** list);

/**
* test_subject_may_return_null:
* @return_nil:
Expand Down

0 comments on commit 22358e7

Please sign in to comment.