Skip to content

Broken GLib.Value bindings #46

Description

@sdroege

Currently GLib.Value is a value type (aka struct). This means that it can't have a finalizer and also that it can be simply copied around without any additional operations happening.

All that is fine if the value contains integers or similar things but falls apart if it contains pointers to something else (strings, objects, boxed types, ...). Then it will

  • cause memory leaks (a manual Dispose() call will fix that but the GC would never do that automatically)
  • memory corruptions (value types can be copied around and then we have two GLib.Values with the same pointer...)

Value types should never be used for anything that handles native resources for the above reasons.

Unfortunately changing it to a reference type (aka class) is not so easy due to how it is used everywhere right now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions