Creating GLib.Bytes() from native pointer fails
Open
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 491
- Forks
- 81
- PR merge metrics
- No merged PRs in 30d
Description
For GObject based types I can just pass the native pointer to the constructor to wrap native pointer.
But that doesn't work for record based types like GBytes():
GLib = require("lgi").GLib
b = GLib.Bytes("foo")
b2 = GLib.Bytes(b._native)
.../lgi/record.lua:156: bad argument #2 to 'ctor' (table expected, got userdata)
stack traceback:
[C]: in function 'ctor'
.../lgi/record.lua:156: in function <.../lgi/record.lua:156>
(tail call): ?
stdin:3: in main chunk
[C]: ?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at lgi/record.lua:156, where the record constructor rejects the userdata passed as b._native. Reproduce the GLib.Bytes example from the issue, then verify that constructing from the native pointer succeeds without the shown error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100