gtk-rs / gtk-rs-core

Rust bindings for GNOME libraries
https://gtk-rs.org/gtk-rs-core
MIT License
272 stars 105 forks source link

gio: correctly free argument list items #1331

Closed vhakulinen closed 4 months ago

vhakulinen commented 4 months ago

Correctly free items from ArgumentList.

Extend tests a bit.

Fix #1330

sdroege commented 4 months ago

The Windows test failure looks relevant:

---- subclass::application::tests::test_simple_application stdout ----
thread 'subclass::application::tests::test_simple_application' panicked at gio\src\subclass\application.rs:422:17:
assertion `left == right` failed
  left: ["D:\\a\\gtk-rs-core\\gtk-rs-core\\target\\debug\\deps\\gio-0cfcd1b38448b701.exe"]
 right: ["--global-1", "--global-2"]
vhakulinen commented 4 months ago

Huh? There must be something fundamentally different how arguments are handled in windows, right? Or is the test setup just platform dependent?

sdroege commented 4 months ago

I don't know, it seems very strange that the explicitly passed arguments get dropped and instead argv[0] is passed through (which is not passed by the test at all!).

It's a bug (or feature?) in GLib though: https://gitlab.gnome.org/GNOME/glib/-/blob/e64a93269d09302d7a4facbc164b7fe9c2ad0836/gio/gapplication.c#L2605

This originally comes from https://gitlab.gnome.org/GNOME/glib/-/commit/e5f91951a132b4a7daa848887a87ba22f96568bc.

This seems very unexpected but is documented:

Note that on Windows, argc and argv are ignored, and g_win32_get_command_line() is called internally (for proper support of Unicode commandline arguments).

Can you special case this in the test for Windows for now, i.e. skip the test on Windows with a comment about the above?

vhakulinen commented 4 months ago

Hope the cfg attrs are correct, I don't have windows machine to test on.

sdroege commented 4 months ago

I don't have windows machine to test on

Me neither, that's why we have CI :rofl: