[beast] BSE: fixed dangling pointer to temporary
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast] BSE: fixed dangling pointer to temporary
- Date: Tue, 23 Oct 2012 16:09:02 +0000 (UTC)
commit fd03d7275711266e1350f7fb85c23b0996060fcd
Author: Tim Janik <timj gnu org>
Date: Mon Oct 22 02:38:34 2012 +0200
BSE: fixed dangling pointer to temporary
bse/bsetype.c | 31 ++++++++++++-------------------
1 files changed, 12 insertions(+), 19 deletions(-)
---
diff --git a/bse/bsetype.c b/bse/bsetype.c
index 1d89b36..9c091ff 100644
--- a/bse/bsetype.c
+++ b/bse/bsetype.c
@@ -105,7 +105,7 @@ bse_type_add_license (GType type,
g_type_set_qdata (type, quark_license, g_strdup (license));
}
-GType
+GType
bse_type_register_static (GType parent_type,
const gchar *type_name,
const gchar *type_blurb,
@@ -113,28 +113,25 @@ bse_type_register_static (GType parent_type,
guint line,
const GTypeInfo *info)
{
- GType type;
-
+ GTypeInfo tmp_info;
+
/* some builtin types have destructors eventhough they are registered
* statically, compensate for that
*/
if (G_TYPE_IS_INSTANTIATABLE (parent_type) && info->class_finalize)
{
- GTypeInfo tmp_info;
-
tmp_info = *info;
tmp_info.class_finalize = NULL;
info = &tmp_info;
}
-
- type = g_type_register_static (parent_type, type_name, info, 0);
-
+
+ const GType type = g_type_register_static (parent_type, type_name, info, 0);
bse_type_add_blurb (type, type_blurb, file, line);
-
+
return type;
}
-GType
+GType
bse_type_register_abstract (GType parent_type,
const gchar *type_name,
const gchar *type_blurb,
@@ -142,28 +139,24 @@ bse_type_register_abstract (GType parent_type,
guint line,
const GTypeInfo *info)
{
- GType type;
-
+ GTypeInfo tmp_info;
+
/* some builtin types have destructors eventhough they are registered
* statically, compensate for that
*/
if (G_TYPE_IS_INSTANTIATABLE (parent_type) && info->class_finalize)
{
- GTypeInfo tmp_info;
-
tmp_info = *info;
tmp_info.class_finalize = NULL;
info = &tmp_info;
}
-
- type = g_type_register_static (parent_type, type_name, info, G_TYPE_FLAG_ABSTRACT);
-
+
+ const GType type = g_type_register_static (parent_type, type_name, info, G_TYPE_FLAG_ABSTRACT);
bse_type_add_blurb (type, type_blurb, file, line);
-
return type;
}
-GType
+GType
bse_type_register_dynamic (GType parent_type,
const gchar *type_name,
GTypePlugin *plugin)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]