+ pspec = g_param_spec_pool_lookup (pspec_pool, name, object_type, TRUE);
+
+ if G_UNLIKELY (!pspec)
+ {
+ g_critical ("%s: object class '%s' has no property named '%s'",
+ G_STRFUNC, g_type_name (object_type), name);
+ /* Can't continue because arg list will be out of sync. */
+ break;
+ }
+
+ if G_UNLIKELY (~pspec->flags & G_PARAM_WRITABLE)
+ {
+ g_critical ("%s: property '%s' of object class '%s' is not writable",
+ G_STRFUNC, pspec->name, g_type_name (object_type));
+ break;
+ }
+
+ if (pspec->flags & (G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT_ONLY))
+ {
+ for (i = 0; i < n_params; i++)
+ if (params[i].pspec == pspec)
+ break;
+ if G_UNLIKELY (i != n_params)
+ {
+ g_critical ("%s: property '%s' for type '%s' cannot be set twice",
+ G_STRFUNC, name, g_type_name (object_type));
+ break;
+ }
+ }
+
+ if (n_params == 16)
+ {
+ params = g_new (GObjectConstructParam, n_params + 1);
+ memcpy (params, stack_params, sizeof stack_params);
+ }
+ else if (n_params > 16)
+ params = g_renew (GObjectConstructParam, params, n_params + 1);
+
+ params[n_params].pspec = pspec;
+ params[n_params].value = g_newa (GValue, 1);
+ memset (params[n_params].value, 0, sizeof (GValue));
+
+ G_VALUE_COLLECT_INIT (params[n_params].value, pspec->value_type, var_args, 0, &error);
+
+ if (error)
+ {
+ g_critical ("%s: %s", G_STRFUNC, error);
+ g_value_unset (params[n_params].value);
+ g_free (error);
+ break;
+ }
+
+ n_params++;
+ }
+ while ((name = va_arg (var_args, const gchar *)));
+
+ object = g_object_new_internal (class, params, n_params);
+
+ while (n_params--)
+ g_value_unset (params[n_params].value);
+
+ if (params != stack_params)
+ g_free (params);
+ }
+ else
+ /* Fast case: no properties passed in. */
+ object = g_object_new_internal (class, NULL, 0);
+
+ if (unref_class)
+ g_type_class_unref (unref_class);