|
1 |
| -diff --git a/glib/glibmm/object.cc b/glib/glibmm/object.cc |
2 |
| -index 30703d7d..38a79a2e 100644 |
3 |
| ---- a/glib/glibmm/object.cc |
4 |
| -+++ b/glib/glibmm/object.cc |
5 |
| -@@ -30,7 +30,7 @@ namespace Glib |
6 |
| - { |
7 |
| - |
8 |
| - ConstructParams::ConstructParams(const Glib::Class& glibmm_class_) |
9 |
| --: glibmm_class(glibmm_class_), n_parameters(0), parameter_names(nullptr), parameter_values(nullptr) |
10 |
| -+: glibmm_class(glibmm_class_), n_parameters(0), parameters(nullptr) |
11 |
| - { |
12 |
| - } |
13 |
| - |
14 |
| -@@ -46,7 +46,7 @@ ConstructParams::ConstructParams(const Glib::Class& glibmm_class_) |
15 |
| - */ |
16 |
| - ConstructParams::ConstructParams( |
17 |
| - const Glib::Class& glibmm_class_, const char* first_property_name, ...) |
18 |
| --: glibmm_class(glibmm_class_), n_parameters(0), parameter_names(nullptr), parameter_values(nullptr) |
19 |
| -+: glibmm_class(glibmm_class_), n_parameters(0), parameters(nullptr) |
20 |
| - { |
21 |
| - va_list var_args; |
22 |
| - va_start(var_args, first_property_name); |
23 |
| -@@ -69,26 +69,23 @@ ConstructParams::ConstructParams( |
24 |
| - break; |
25 |
| - } |
26 |
| - |
27 |
| -- if (n_parameters >= n_alloced_params) { |
28 |
| -- n_alloced_params += 8; |
29 |
| -- parameter_names = g_renew(const char*, parameter_names, n_alloced_params); |
30 |
| -- parameter_values = g_renew(GValue, parameter_values, n_alloced_params); |
31 |
| -- } |
32 |
| -+ if (n_parameters >= n_alloced_params) |
33 |
| -+ parameters = g_renew(GParameter, parameters, n_alloced_params += 8); |
34 |
| -+ |
35 |
| -+ GParameter& param = parameters[n_parameters]; |
36 |
| - |
37 |
| -- auto& param_name = parameter_names[n_parameters]; |
38 |
| -- auto& param_value = parameter_values[n_parameters]; |
39 |
| -- param_name = name; |
40 |
| -- param_value.g_type = 0; |
41 |
| -+ param.name = name; |
42 |
| -+ param.value.g_type = 0; |
43 |
| - |
44 |
| - // Fill the GValue with the current vararg, and move on to the next one. |
45 |
| -- g_value_init(¶m_value, G_PARAM_SPEC_VALUE_TYPE(pspec)); |
46 |
| -- G_VALUE_COLLECT(¶m_value, var_args, 0, &collect_error); |
47 |
| -+ g_value_init(¶m.value, G_PARAM_SPEC_VALUE_TYPE(pspec)); |
48 |
| -+ G_VALUE_COLLECT(¶m.value, var_args, 0, &collect_error); |
49 |
| - |
50 |
| - if (collect_error) |
51 |
| - { |
52 |
| - g_warning("Glib::ConstructParams::ConstructParams(): %s", collect_error); |
53 |
| - g_free(collect_error); |
54 |
| -- g_value_unset(¶m_value); |
55 |
| -+ g_value_unset(¶m.value); |
56 |
| - break; |
57 |
| - } |
58 |
| - |
59 |
| -@@ -102,13 +99,10 @@ ConstructParams::ConstructParams( |
60 |
| - |
61 |
| - ConstructParams::~ConstructParams() noexcept |
62 |
| - { |
63 |
| -- while (n_parameters > 0) { |
64 |
| -- auto& param_value = parameter_values[--n_parameters]; |
65 |
| -- g_value_unset(¶m_value); |
66 |
| -- } |
67 |
| -+ while (n_parameters > 0) |
68 |
| -+ g_value_unset(¶meters[--n_parameters].value); |
69 |
| - |
70 |
| -- g_free(parameter_names); |
71 |
| -- g_free(parameter_values); |
72 |
| -+ g_free(parameters); |
73 |
| - } |
74 |
| - |
75 |
| - /**** Glib::Object_Class ***************************************************/ |
76 |
| -@@ -166,10 +160,10 @@ Object::Object() |
77 |
| - custom_class_init_finished(); |
78 |
| - } |
79 |
| - |
80 |
| -- GObject* const new_object = g_object_new_with_properties(object_type, 0, nullptr, nullptr); |
81 |
| -+ void* const new_object = g_object_newv(object_type, 0, nullptr); |
82 |
| - |
83 |
| - // Connect the GObject and Glib::Object instances. |
84 |
| -- ObjectBase::initialize(new_object); |
85 |
| -+ ObjectBase::initialize(static_cast<GObject*>(new_object)); |
86 |
| - } |
87 |
| - |
88 |
| - Object::Object(const Glib::ConstructParams& construct_params) |
89 |
| -@@ -193,11 +187,11 @@ Object::Object(const Glib::ConstructParams& construct_params) |
90 |
| - // This works with custom types too, since those inherit the properties of |
91 |
| - // their base class. |
92 |
| - |
93 |
| -- GObject* const new_object = |
94 |
| -- g_object_new_with_properties(object_type, construct_params.n_parameters, construct_params.parameter_names, construct_params.parameter_values); |
95 |
| -+ void* const new_object = |
96 |
| -+ g_object_newv(object_type, construct_params.n_parameters, construct_params.parameters); |
97 |
| - |
98 |
| - // Connect the GObject and Glib::Object instances. |
99 |
| -- ObjectBase::initialize(new_object); |
100 |
| -+ ObjectBase::initialize(static_cast<GObject*>(new_object)); |
101 |
| - } |
102 |
| - |
103 |
| - Object::Object(GObject* castitem) |
104 |
| -diff --git a/glib/glibmm/object.h b/glib/glibmm/object.h |
105 |
| -index 4cb6ad91..2a1f7f2f 100644 |
106 |
| ---- a/glib/glibmm/object.h |
107 |
| -+++ b/glib/glibmm/object.h |
108 |
| -@@ -53,9 +53,8 @@ class GLIBMM_API GSigConnectionNode; |
109 |
| - |
110 |
| - /* ConstructParams::ConstructParams() takes a varargs list of properties |
111 |
| - * and values, like g_object_new() does. This list will then be converted |
112 |
| -- * to an array of parameter names and an array of parameter values, |
113 |
| -- * for use with g_object_new_with_properties(). No overhead is |
114 |
| -- * involved, since g_object_new() is just a wrapper around g_object_new_with_properties() |
115 |
| -+ * to a GParameter array, for use with g_object_newv(). No overhead is |
116 |
| -+ * involved, since g_object_new() is just a wrapper around g_object_newv() |
117 |
| - * as well. |
118 |
| - * |
119 |
| - * The advantage of an auxiliary ConstructParams object over g_object_new() |
120 |
| -@@ -71,8 +70,7 @@ class GLIBMM_API ConstructParams |
121 |
| - public: |
122 |
| - const Glib::Class& glibmm_class; |
123 |
| - unsigned int n_parameters; |
124 |
| -- const char ** parameter_names; |
125 |
| -- GValue* parameter_values; |
126 |
| -+ GParameter* parameters; |
127 |
| - |
128 |
| - explicit ConstructParams(const Glib::Class& glibmm_class_); |
129 |
| - ConstructParams(const Glib::Class& glibmm_class_, const char* first_property_name, |
130 | 1 | diff --git a/meson.build b/meson.build
|
131 | 2 | index 2eefa135..0109a99d 100644
|
132 | 3 | --- a/meson.build
|
|
0 commit comments