lgi-devs / lgi

Dynamic Lua binding to GObject libraries using GObject-Introspection
MIT License
440 stars 70 forks source link

Segmentation fault when using netwok manager #294

Open Kasper24 opened 2 years ago

Kasper24 commented 2 years ago
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007ffff7fb2266 in lgi_object_2c () from /usr/lib/lua/5.3/lgi/corelgilua51.so

#0  0x00007ffff7fb2266 in lgi_object_2c () at /usr/lib/lua/5.3/lgi/corelgilua51.so
#1  0x00007ffff7fb4792 in lgi_marshal_2c () at /usr/lib/lua/5.3/lgi/corelgilua51.so
#2  0x00007ffff7fb638c in  () at /usr/lib/lua/5.3/lgi/corelgilua51.so
#3  0x00007ffff7fb465d in lgi_marshal_2c () at /usr/lib/lua/5.3/lgi/corelgilua51.so
#4  0x00007ffff7fb4d17 in  () at /usr/lib/lua/5.3/lgi/corelgilua51.so
#5  0x00007ffff7fb5166 in  () at /usr/lib/lua/5.3/lgi/corelgilua51.so
#6  0x00007ffff792ffff in  () at /usr/lib/liblua5.3.so.5.3
#7  0x00007ffff793d72d in  () at /usr/lib/liblua5.3.so.5.3
#8  0x00007ffff79303b8 in  () at /usr/lib/liblua5.3.so.5.3
#9  0x00007ffff792f710 in  () at /usr/lib/liblua5.3.so.5.3
#10 0x00007ffff793073b in  () at /usr/lib/liblua5.3.so.5.3
#11 0x00007ffff792b91a in lua_pcallk () at /usr/lib/liblua5.3.so.5.3
#12 0x00007ffff7fb5927 in  () at /usr/lib/lua/5.3/lgi/corelgilua51.so
#13 0x00007ffff738e0fb in  () at /usr/lib/libffi.so.8
#14 0x00007ffff738e758 in  () at /usr/lib/libffi.so.8
#15 0x00007ffff75855f4 in  () at /usr/lib/libgio-2.0.so.0
#16 0x00007ffff758562d in  () at /usr/lib/libgio-2.0.so.0
#17 0x00007ffff7ddb163 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#18 0x00007ffff7e319e9 in  () at /usr/lib/libglib-2.0.so.0
#19 0x00007ffff7dda6a3 in g_main_loop_run () at /usr/lib/libglib-2.0.so.0
#20 0x0000555555568ecb in main ()

Snippest:

for _, device in ipairs(devices) do
   if device:get_device_type() == "WIFI" then
        device.on_state_changed = function(device)
           local state = device:get_state()
           local state_reason = device:get_state_reason()

          if (state == "UNAVAILABLE" or state == "FAILED" or state == "DEACTIVATING")
             and state_reason ~= "NEW_ACTIVATION" then
             self:emit_signal("wireless_state", false)
          elseif state ==  "DISCONNECTED" and state_reason ~= "NEW_ACTIVATION" then
             gtimer { timeout = 5, autostart = true, call_now = false, single_shot = true, callback = function()
                self:scan_access_points()
             end }
          elseif state == "ACTIVATED" then
              local active_access_point = device:get_active_access_point()
              self:scan_access_points()
              self:emit_signal("wireless_state", true, ssid_to_utf8(active_access_point))
          end
   end
end
ntd commented 2 years ago

It would help a lot if you condense this monster into the one-liner that triggers the crash. A link to the API documentation would have avoided a lot of guesswork too. Having something that can be run would also be appreciated.

From a quick look, I can see at least the folling issues: