Closed TobiasMorell closed 4 years ago
The GEnum derive macro did not check whether an enum exists before registering it, leading to a panic if the same enum is registered twice:
GEnum
GLib-GObject-WARNING **: 08:04:50.392: cannot register existing type 'EnumName' thread '<unnamed>' panicked at 'assertion failed: `(left != right)` left: `<invalid>`, right: `<invalid>`', /path/to/source.rs note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
This PR makes sure that enums are only registered if gobject_sys::g_type_from_name returns 0.
gobject_sys::g_type_from_name
0
The
GEnum
derive macro did not check whether an enum exists before registering it, leading to a panic if the same enum is registered twice:This PR makes sure that enums are only registered if
gobject_sys::g_type_from_name
returns0
.