Skip to content

Commit eb59044

Browse files
committed
refactor: restore main comments on ffi.load_enum
1 parent 9b1cffe commit eb59044

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

lgi/ffi.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ function ffi.load_enum(gtype, name)
8080
local enum_component = component.create(
8181
gtype, is_flags and enum.bitflags_mt or enum.enum_mt, name)
8282
local type_class
83+
-- GLib >= 2.86 deprecates GObject.TypeClass.ref() in favour of .get()
8384
if GLib.check_version(2, 86, 0) then
8485
type_class = GObject.TypeClass.ref(gtype)
8586
else
@@ -97,6 +98,7 @@ function ffi.load_enum(gtype, name)
9798
enum_component[core.upcase(val.value_nick):gsub('%-', '_')] = val.value
9899
end
99100
end
101+
-- For GLib versions below 2.86, type_class was ref'd and needs to be unref'd
100102
if GLib.check_version(2, 86, 0) then
101103
type_class:unref()
102104
end

0 commit comments

Comments
 (0)