lgi-devs / lgi-devs/lgi

Incompatibility with gobject-introspection 1.86: core.record.fromarray() receives table instead of lgi.record

Open
#362 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
491
Forks
81
PR merge metrics
No merged PRs in 30d

Description

Environment

  • lgi: 0.9.2 (also tested with current master dfa8297)
  • gobject-introspection: 1.86.0
  • Lua: 5.4.8
  • OS: Chimera Linux (musl libc)

Description

When loading cairo via lgi, core.record.fromarray() in ffi.lua:86
receives a Lua table instead of an lgi.record when iterating
GEnumClass.values, causing a crash at startup.

Error

lgi/ffi.lua:86: bad argument #1 to 'fromarray' (lgi.record expected, got table)

Stack trace:

[C]: in field 'fromarray' /usr/share/lua/5.4/lgi/ffi.lua:86: in function 'lgi.ffi.load_enum' /usr/share/lua/5.4/lgi/override/cairo.lua:49: in main chunk

Cause

GEnumClass.values in gobject-introspection 1.86 appears to be exposed
as a Lua table instead of a lgi.record, breaking core.record.fromarray()
in record.c. This seems to be a behavioral change in how g-i 1.86
exposes GEnumValue* arrays.

Impact

Any application using lgi + cairo on systems with gobject-introspection
1.86 (e.g. AwesomeWM) is completely broken.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at ffi.lua:86 and trace lgi.ffi.load_enum, then inspect record.c and override/cairo.lua:49 to understand how GEnumClass.values is passed to core.record.fromarray(). Reproduce cairo loading with gobject-introspection 1.86; done means it no longer crashes when GEnumClass.values is exposed as a Lua table.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.