Skip to content

Commit db7405f

Browse files
authored
Merge pull request #50 from swami/bugs-cleanup
Fix bugs and clean up
2 parents f697e43 + e0a51ae commit db7405f

10 files changed

+22
-31
lines changed

Diff for: libinstpatch/IpatchContainer.c

+8-3
Original file line numberDiff line numberDiff line change
@@ -232,14 +232,19 @@ const GType *
232232
ipatch_container_get_child_types(IpatchContainer *container)
233233
{
234234
IpatchContainerClass *klass;
235-
const GType *types;
236235

237236
g_return_val_if_fail(IPATCH_IS_CONTAINER(container), 0);
238237

239238
klass = IPATCH_CONTAINER_GET_CLASS(container);
240-
types = klass->child_types();
241239

242-
return (types);
240+
if(klass->child_types)
241+
{
242+
return(klass->child_types());
243+
}
244+
else
245+
{
246+
return(NULL);
247+
}
243248
}
244249

245250
/**

Diff for: libinstpatch/IpatchDLS2.c

-6
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ static gpointer parent_class = NULL;
7474
static GType dls2_child_types[3] = { 0 };
7575
static GType dls2_virt_types[4] = { 0 };
7676

77-
/* for chaining to original file-name property */
78-
static IpatchItemClass *base_item_class;
79-
8077

8178

8279
/* SoundFont item type creation function */
@@ -111,9 +108,6 @@ ipatch_dls2_class_init(IpatchDLS2Class *klass)
111108
IpatchContainerClass *container_class = IPATCH_CONTAINER_CLASS(klass);
112109
IpatchBaseClass *base_class = IPATCH_BASE_CLASS(klass);
113110

114-
/* save original base class for chaining file-name property */
115-
base_item_class = IPATCH_ITEM_CLASS(g_type_class_ref(IPATCH_TYPE_BASE));
116-
117111
parent_class = g_type_class_peek_parent(klass);
118112

119113
obj_class->finalize = ipatch_dls2_finalize;

Diff for: libinstpatch/IpatchItem.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ ipatch_item_class_init(IpatchItemClass *klass)
276276
g_object_class_install_property(obj_class, PROP_FLAGS,
277277
g_param_spec_uint("flags", _("Flags"), _("Flags"),
278278
0, G_MAXUINT, 0,
279-
G_PARAM_READABLE | IPATCH_PARAM_HIDE
279+
G_PARAM_READWRITE | IPATCH_PARAM_HIDE
280280
| IPATCH_PARAM_NO_SAVE_CHANGE
281281
| IPATCH_PARAM_NO_SAVE));
282282
g_object_class_install_property(obj_class, PROP_PARENT,

Diff for: libinstpatch/IpatchSF2.c

+1-5
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ static void ipatch_sf2_foreach_info_GHFunc(gpointer key, gpointer value,
9797
static int ipatch_sf2_info_array_qsort(const void *a, const void *b);
9898

9999
static gpointer parent_class = NULL;
100-
static IpatchItemClass *base_item_class;
101100

102101
static GType sf2_child_types[4] = { 0 };
103102
static GType sf2_virt_types[6] = { 0 };
@@ -135,10 +134,7 @@ ipatch_sf2_class_init(IpatchSF2Class *klass)
135134
IpatchBaseClass *base_class = IPATCH_BASE_CLASS(klass);
136135
GParamSpec **sp = &info_prop_pspecs[0];
137136

138-
/* save original base class for chaining file-name property */
139-
base_item_class = IPATCH_ITEM_CLASS(g_type_class_ref(IPATCH_TYPE_BASE));
140-
141-
parent_class = g_type_class_ref(IPATCH_TYPE_BASE);
137+
parent_class = g_type_class_peek_parent(klass);
142138

143139
obj_class->finalize = ipatch_sf2_finalize;
144140
obj_class->get_property = ipatch_sf2_get_property;

Diff for: libinstpatch/IpatchSF2Gen.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -147,23 +147,23 @@ _ipatch_sf2_gen_init(void)
147147

148148
gen_property_names = g_malloc(sizeof(char *) * IPATCH_SF2_GEN_COUNT);
149149

150-
enum_class = g_type_class_ref(IPATCH_TYPE_SF2_GEN_TYPE);
150+
enum_class = g_type_class_ref(IPATCH_TYPE_SF2_GEN_TYPE); /* ++ref */
151151

152152
if(log_if_fail(enum_class != NULL)) /* shouldn't happen.. just in case */
153153
{
154154
for(i = 0; i < IPATCH_SF2_GEN_COUNT; i++)
155155
{
156156
gen_property_names[i] = NULL;
157157
}
158-
159-
return;
160158
}
161-
162-
for(i = 0; i < IPATCH_SF2_GEN_COUNT; i++)
159+
else for(i = 0; i < IPATCH_SF2_GEN_COUNT; i++)
163160
{
164161
enum_val = g_enum_get_value(enum_class, i);
165162
gen_property_names[i] = enum_val ? enum_val->value_nick : NULL;
166163
}
164+
165+
g_type_class_unref(enum_class); /* --ref */
166+
167167
}
168168

169169
/**

Diff for: libinstpatch/IpatchSF2GenItem.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ ipatch_sf2_gen_item_iface_install_properties(GObjectClass *klass,
640640
ispreset = propstype & 1;
641641

642642
/* get generator type GObject enum */
643-
enum_class = g_type_class_ref(IPATCH_TYPE_SF2_GEN_TYPE);
643+
enum_class = g_type_class_ref(IPATCH_TYPE_SF2_GEN_TYPE); /* ++ref */
644644
g_return_if_fail(enum_class != NULL);
645645

646646
*specs = g_new(GParamSpec *, IPATCH_SF2_GEN_COUNT);
@@ -713,7 +713,7 @@ ipatch_sf2_gen_item_iface_install_properties(GObjectClass *klass,
713713
}
714714
else if(unit == IPATCH_UNIT_TYPE_SF2_ABS_TIME)
715715
{
716-
unit = IPATCH_UNIT_TYPE_SF2_OFS_PITCH;
716+
unit = IPATCH_UNIT_TYPE_SF2_OFS_TIME;
717717
}
718718
}
719719

@@ -731,6 +731,8 @@ ipatch_sf2_gen_item_iface_install_properties(GObjectClass *klass,
731731
/* install "-set" property */
732732
g_object_class_install_property(klass, i + IPATCH_SF2_GEN_ITEM_FIRST_PROP_SET_ID, pspec);
733733
} /* for loop */
734+
735+
g_type_class_unref(enum_class); /* --ref */
734736
}
735737

736738
/**

Diff for: libinstpatch/IpatchSF2Inst.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ ipatch_sf2_inst_class_init(IpatchSF2InstClass *klass)
127127
IpatchItemClass *item_class = IPATCH_ITEM_CLASS(klass);
128128
IpatchContainerClass *container_class = IPATCH_CONTAINER_CLASS(klass);
129129

130-
parent_class = g_type_class_ref(IPATCH_TYPE_CONTAINER);
130+
parent_class = g_type_class_peek_parent(klass);
131131

132132
obj_class->finalize = ipatch_sf2_inst_finalize;
133133
obj_class->get_property = ipatch_sf2_inst_get_property;

Diff for: libinstpatch/IpatchSF2Preset.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ ipatch_sf2_preset_class_init(IpatchSF2PresetClass *klass)
132132
IpatchItemClass *item_class = IPATCH_ITEM_CLASS(klass);
133133
IpatchContainerClass *container_class = IPATCH_CONTAINER_CLASS(klass);
134134

135-
parent_class = g_type_class_ref(IPATCH_TYPE_CONTAINER);
135+
parent_class = g_type_class_peek_parent(klass);
136136

137137
obj_class->finalize = ipatch_sf2_preset_finalize;
138138
obj_class->get_property = ipatch_sf2_preset_get_property;

Diff for: libinstpatch/IpatchSLI.c

-6
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ static gpointer parent_class = NULL;
6767
static GType sli_child_types[3] = { 0 };
6868
static GType sli_virt_types[3] = { 0 };
6969

70-
/* for chaining to original file-name property */
71-
static IpatchItemClass *base_item_class;
72-
7370

7471
/* Spectralis item type creation function */
7572
GType
@@ -102,9 +99,6 @@ ipatch_sli_class_init(IpatchSLIClass *klass)
10299
IpatchItemClass *item_class = IPATCH_ITEM_CLASS(klass);
103100
IpatchContainerClass *container_class = IPATCH_CONTAINER_CLASS(klass);
104101

105-
/* save original base class for chaining file-name property */
106-
base_item_class = IPATCH_ITEM_CLASS(g_type_class_ref(IPATCH_TYPE_BASE));
107-
108102
parent_class = g_type_class_peek_parent(klass);
109103

110104
obj_class->get_property = ipatch_sli_get_property;

Diff for: libinstpatch/IpatchSLIInst.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ ipatch_sli_inst_class_init(IpatchSLIInstClass *klass)
105105
IpatchItemClass *item_class = IPATCH_ITEM_CLASS(klass);
106106
IpatchContainerClass *container_class = IPATCH_CONTAINER_CLASS(klass);
107107

108-
parent_class = g_type_class_ref(IPATCH_TYPE_CONTAINER);
108+
parent_class = g_type_class_peek_parent(klass);
109109

110110
obj_class->finalize = ipatch_sli_inst_finalize;
111111
obj_class->get_property = ipatch_sli_inst_get_property;

0 commit comments

Comments
 (0)