Closed vhakulinen closed 4 months ago
There seems to be a test case for this here: https://github.com/gtk-rs/gtk-rs-core/blob/55f5117feb720248c75e02169cff35d31be806c6/gio/src/subclass/application.rs#L431-L449
Tho' that has a bug: the arguments passed to it are just --local
, while they should be --local-arg
so something like that.
This patch might fix the issue:
diff --git a/gio/src/subclass/application.rs b/gio/src/subclass/application.rs
index e6005847bd..3e8f4c9655 100644
--- a/gio/src/subclass/application.rs
+++ b/gio/src/subclass/application.rs
@@ -33,7 +33,7 @@ impl ArgumentList {
self.items.remove(idx);
- glib::ffi::g_free((*self.ptr).add(idx) as *mut c_void);
+ glib::ffi::g_free(*(*self.ptr).add(idx) as *mut c_void);
for i in idx..n_args - 1 {
ptr::write((*self.ptr).add(i), *(*self.ptr).add(i + 1))
@@ -464,6 +464,6 @@ mod tests {
app.set_inactivity_timeout(10000);
- assert_eq!(app.run_with_args(&["--local"]), EXIT_STATUS.into());
+ assert_eq!(app.run_with_args(&["--local-"]), EXIT_STATUS.into());
}
}
Bug description
Calling
ArgumentList::remove
with anything other that 0 causes segmentation fault.Additionally, calling
ArgumentList::remove
with 0 causes segmentation fault after returning fromlocal_command_line
.Backtrace
gdb backtrace: