Skip to content

v0.9.14 - Boxed allocation and GObject ownership fixes, GTK3 event signals fixed, nullable struct pointer parameters

Latest

Choose a tag to compare

@elementgreen elementgreen released this 25 Oct 04:41
· 59 commits to main since this release

This release is focused on memory management and ownership fixes. It resolves a number of crashes, double frees, and leaks, along with some API improvements to simple structure handling.

Boxed types created from D are now allocated through the type's own g_boxed_copy() so that the allocator always matches the type's free function. This fixes GSlice corruption crashes on systems with GLib older than 2.76, such as Ubuntu 22.04 with GTK 4.6 (#41). Struct return values with full ownership are no longer leaked.

GObject finalization now always happens in the main thread context, which fixes crashes during garbage collection on macOS (#54). ErrorWrap now has an explicit mandatory Take ownership argument, which fixes GError double frees (#55). GTK3 event signals such as key-press-event now correctly receive their boxed event objects instead of null (#52). GidBuilder build() methods and ObjectWrap(GType) no longer leak or over-unref objects, and floating references are consistently sunk.

Nullable simple structure parameters are now D pointers, so null can be passed where the C API allows it, for example Snapshot.toPaintable(Size* size = null) and Popover.setPointingTo(Rectangle* rect = null). Non-boxed wrapped structures without a C constructor, such as gsk.RoundedRect, now have a D constructor. Fields of structures with fixed arrays and containers can now be read.

The giD loader was also fixed on Mac and Windows.

API changes: ErrorWrap constructors require a Take flag argument, and glib2.propagateError was removed. boxedCopy and boxedFree take a GType instead of a template type. Nullable simple structure parameters are now pointers. Structure fields which conflict with an identically named method are no longer generated (for example the glib.Hook.destroy field).

  • 0ce9680 (Element Green): Nullable struct pointer params, wrap constructors, and field/method conflicts
  • 3aa4c0c (Element Green): Fix boxed allocation mismatches and struct return value leaks (#41)
  • aa3b34d (Element Green): Fix GObject reference leaks with builders and ObjectWrap(GType)
  • 8e394ae (Element Green): ErrorWrap GError ownership fixes (#55)
  • 87df7c5 (Element Green): Improve Value boxed type handling (#52)
  • c415835 (Element Green): Generate loader.d
  • 28f0b53 (Element Green): Fix giD loader on Mac and Windows
  • c4402e4 (Element Green): Ensure ObjectWrapper C GObject finalize happens in main thread context (#54)
  • 876b1eb (Element Green): Add field array and container read support