Fixed GLib.Value nulls setter
Some GValue types support null value but code was not checking for .NET "null" and get null ref exception. Fixed nulls for g_value_set_variant, g_value_set_object, g_value_set_boxed as in GLib docs. This fixes NodeView with null pixbuf column.
This commit is contained in:
parent
be5f81a7f0
commit
ad0420b118
1 changed files with 13 additions and 3 deletions
|
@ -533,8 +533,12 @@ namespace GLib {
|
||||||
g_value_set_float (ref this, (float) value);
|
g_value_set_float (ref this, (float) value);
|
||||||
else if (type == GType.Double.Val)
|
else if (type == GType.Double.Val)
|
||||||
g_value_set_double (ref this, (double) value);
|
g_value_set_double (ref this, (double) value);
|
||||||
else if (type == GType.Variant.Val)
|
else if (type == GType.Variant.Val) {
|
||||||
|
if (value is null)
|
||||||
|
g_value_set_variant (ref this, IntPtr.Zero);
|
||||||
|
else
|
||||||
g_value_set_variant (ref this, ((GLib.Variant) value).Handle);
|
g_value_set_variant (ref this, ((GLib.Variant) value).Handle);
|
||||||
|
}
|
||||||
else if (type == GType.String.Val) {
|
else if (type == GType.String.Val) {
|
||||||
IntPtr native = GLib.Marshaller.StringToPtrGStrdup ((string)value);
|
IntPtr native = GLib.Marshaller.StringToPtrGStrdup ((string)value);
|
||||||
g_value_set_string (ref this, native);
|
g_value_set_string (ref this, native);
|
||||||
|
@ -559,11 +563,17 @@ namespace GLib {
|
||||||
g_value_set_boxed (ref this, wrapper);
|
g_value_set_boxed (ref this, wrapper);
|
||||||
ManagedValue.ReleaseWrapper (wrapper);
|
ManagedValue.ReleaseWrapper (wrapper);
|
||||||
} else if (GType.Is (type, GType.Object))
|
} else if (GType.Is (type, GType.Object))
|
||||||
if(value is GLib.Object)
|
if (value is null)
|
||||||
|
g_value_set_object (ref this, IntPtr.Zero);
|
||||||
|
else if (value is GLib.Object)
|
||||||
g_value_set_object (ref this, (value as GLib.Object).Handle);
|
g_value_set_object (ref this, (value as GLib.Object).Handle);
|
||||||
else
|
else
|
||||||
g_value_set_object (ref this, ((GInterfaceAdapter)value).Handle);
|
g_value_set_object (ref this, ((GInterfaceAdapter)value).Handle);
|
||||||
else if (GType.Is (type, GType.Boxed)) {
|
else if (GType.Is (type, GType.Boxed)) {
|
||||||
|
if (value is null) {
|
||||||
|
g_value_set_boxed (ref this, IntPtr.Zero);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (value is IWrapper) {
|
if (value is IWrapper) {
|
||||||
g_value_set_boxed (ref this, ((IWrapper)value).Handle);
|
g_value_set_boxed (ref this, ((IWrapper)value).Handle);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue