You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a native method's return type is a record but can be null, the public API should return null if the native code returns NULL. Currently the public API will never return null in this case; instead it will create and return an object with a NULL handle.
This was observed in Gtk.EventController.GetEvent(), which returns a Gdk.Event?.
Attached is a quick example.
(Move the mouse over the window and then off the window to trigger.)
usingSystem;usingGtk;varapplication=Application.New("org.gir.core",Gio.ApplicationFlags.FlagsNone);application.OnActivate+=(sender,args)=>{varwindow=ApplicationWindow.New((Application)sender);window.Title="Gtk4 Window";varcontroller=EventControllerMotion.New();controller.OnLeave+=OnLeave;window.AddController(controller);window.SetDefaultSize(300,300);window.Show();};voidOnLeave(EventControllerMotionsender,EventArgsargs){Gdk.Event?@event=sender.GetCurrentEvent();if(@event==null)Console.WriteLine("event is null (this is fine)");elseif(@event.Handle.Equals(IntPtr.Zero))Console.WriteLine($"event is not null but handle is NULL (this shouldn't happen)");elseConsole.WriteLine($"event is not null (0x{@event.Handle:x}) (this is fine)");}returnapplication.Run();
If a native method's return type is a record but can be null, the public API should return null if the native code returns NULL. Currently the public API will never return null in this case; instead it will create and return an object with a NULL handle.
This was observed in
Gtk.EventController.GetEvent()
, which returns aGdk.Event?
.Attached is a quick example.
(Move the mouse over the window and then off the window to trigger.)
The text was updated successfully, but these errors were encountered: