lgi-devs / lgi-devs/lgi

app:on_command_line() is broken

Open
#29 2 comments 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

Attempting to use the app:on_command_line signal leads to a crash:

#!/usr/bin/env lua5.1
lgi = require('lgi')
local gtk = lgi.require('Gtk', '3.0')
local gio = lgi.require('Gio', '2.0')

local app = gtk.Application {
    flags = gio.ApplicationFlags.HANDLES_COMMAND_LINE,
}

function app:on_command_line(command) end

app:run { arg[0], ... } --method shown in the examples
--app:run(arg) --another method I thought might work

This script fails with:

lua5.1: /usr/share/lua/5.1/lgi/override/GObject-Value.lua:78: bad argument #3 to 'get' (number expected, got nil)
stack traceback:
    [C]: in function 'get'
    /usr/share/lua/5.1/lgi/override/GObject-Value.lua:78: in function 'marshaller'
    /usr/share/lua/5.1/lgi/override/GObject-Closure.lua:126: in function 'marshal_cell'
    /usr/share/lua/5.1/lgi/override/GObject-Closure.lua:162: in function </usr/share/lua/5.1/lgi/override/GObject-Closure.lua:144>
    [C]: in function 'run'
    ./gtk-test.lua:12: in main chunk
    [C]: ?

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

Run the provided gtk-test.lua reproduction with Lua 5.1 and inspect the failure through lgi/override/GObject-Value.lua and lgi/override/GObject-Closure.lua. Trace app:on_command_line during app:run and make the signal invocation complete without the reported marshalling crash.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.