summaryrefslogtreecommitdiff
path: root/gobject
diff options
context:
space:
mode:
authorTim Janik <timj@gtk.org>2005-09-22 10:48:04 +0000
committerTim Janik <timj@src.gnome.org>2005-09-22 10:48:04 +0000
commitb94a2fe66c06bfecad0f91cfae1966955f9ae67e (patch)
tree9b6f8b929de05cb531765e114bcb1e78380428b1 /gobject
parenta07b4b8c02f4871e2c335de14688164fd7f9cb27 (diff)
fix pspec->name assignment which needs to be strdup()ed for non
Thu Sep 22 12:42:12 2005 Tim Janik <timj@gtk.org> * gparam.c (g_param_spec_internal): fix pspec->name assignment which needs to be strdup()ed for non G_PARAM_STATIC_NAME pspecs. this fixes recently introduced crashes during plugin unloading. also, ensure that static pspec names are canonicalized. * gsignal.h: reverted last change from matthias, we don't guarantee that type ids aren't mangled with G_SIGNAL_TYPE_STATIC_SCOPE anywhere.
Diffstat (limited to 'gobject')
-rw-r--r--gobject/ChangeLog10
-rw-r--r--gobject/gparam.c20
-rw-r--r--gobject/gsignal.h2
3 files changed, 22 insertions, 10 deletions
diff --git a/gobject/ChangeLog b/gobject/ChangeLog
index 659be93d4..60b7f8e83 100644
--- a/gobject/ChangeLog
+++ b/gobject/ChangeLog
@@ -1,3 +1,13 @@
+Thu Sep 22 12:42:12 2005 Tim Janik <timj@gtk.org>
+
+ * gparam.c (g_param_spec_internal): fix pspec->name assignment which
+ needs to be strdup()ed for non G_PARAM_STATIC_NAME pspecs. this fixes
+ recently introduced crashes during plugin unloading.
+ also, ensure that static pspec names are canonicalized.
+
+ * gsignal.h: reverted last change from matthias, we don't guarantee
+ that type ids aren't mangled with G_SIGNAL_TYPE_STATIC_SCOPE anywhere.
+
2005-09-20 Matthias Clasen <mclasen@redhat.com>
* gsignal.h (struct _GSignalQuery): Remove the misleading comment
diff --git a/gobject/gparam.c b/gobject/gparam.c
index 2f983d882..454e34446 100644
--- a/gobject/gparam.c
+++ b/gobject/gparam.c
@@ -291,7 +291,6 @@ g_param_spec_internal (GType param_type,
GParamFlags flags)
{
GParamSpec *pspec;
- gchar *tmp;
g_return_val_if_fail (G_TYPE_IS_PARAM (param_type) && param_type != G_TYPE_PARAM, NULL);
g_return_val_if_fail (name != NULL, NULL);
@@ -300,23 +299,26 @@ g_param_spec_internal (GType param_type,
pspec = (gpointer) g_type_create_instance (param_type);
- if ((flags & G_PARAM_STATIC_NAME))
- pspec->name = g_intern_static_string (name);
+ if (flags & G_PARAM_STATIC_NAME)
+ {
+ pspec->name = g_intern_static_string (name);
+ if (!is_canonical (pspec->name))
+ g_warning ("G_PARAM_STATIC_NAME used with non-canonical pspec name: %s", pspec->name);
+ }
else
{
- tmp = g_strdup (name);
- canonicalize_key (tmp);
- pspec->name = g_intern_string (tmp);
- g_free (tmp);
+ pspec->name = g_strdup (name);
+ canonicalize_key (pspec->name);
+ g_intern_string (pspec->name);
}
if (flags & G_PARAM_STATIC_NICK)
- pspec->_nick = (gchar *) nick;
+ pspec->_nick = (gchar*) nick;
else
pspec->_nick = g_strdup (nick);
if (flags & G_PARAM_STATIC_BLURB)
- pspec->_blurb = (gchar *) blurb;
+ pspec->_blurb = (gchar*) blurb;
else
pspec->_blurb = g_strdup (blurb);
diff --git a/gobject/gsignal.h b/gobject/gsignal.h
index 79e2caaff..61345dcba 100644
--- a/gobject/gsignal.h
+++ b/gobject/gsignal.h
@@ -87,7 +87,7 @@ struct _GSignalQuery
const gchar *signal_name;
GType itype;
GSignalFlags signal_flags;
- GType return_type;
+ GType return_type; /* mangled with G_SIGNAL_TYPE_STATIC_SCOPE flag */
guint n_params;
const GType *param_types; /* mangled with G_SIGNAL_TYPE_STATIC_SCOPE flag */
};