Segmentation fault with `Gio.File.move_async()` progress callback
System information
What is your operating system and version? Fedora Silverblue 39
What is your version of GJS? gjs 1.79.1 (df2bbbbc)
If the bug is related to GNOME Shell, what is your version of GNOME Shell? N/A
Bug information
Steps to reproduce
Segfault is triggered when a GFileProgressCallback
is defined for Gio.File.move_async()
. This callback type can be passed to Gio.File.copy_async()
without problem, though.
import GLib from 'gi://GLib';
import Gio from 'gi://Gio';
Gio._promisify(Gio.File.prototype, 'move_async');
const [source] = Gio.File.new_tmp(null);
const target = Gio.File.new_for_path('test-move.txt');
await source.move_async(
target,
Gio.FileCopyFlags.NONE,
GLib.PRIORITY_DEFAULT,
null, // Gio.Cancellable
() => {}); // Gio.FileProgressCallback
Current behaviour
Thread 1 "gjs" received signal SIGSEGV, Segmentation fault.
classify_argument (type=type@entry=0x7fff005ed6e0, classes=classes@entry=0x7fffffffd810, byte_offset=byte_offset@entry=0) at ../src/x86/ffi64.c:164
164 switch (type->type)
(gdb) bt
#0 classify_argument (type=type@entry=0x7fff005ed6e0, classes=classes@entry=0x7fffffffd810, byte_offset=byte_offset@entry=0) at ../src/x86/ffi64.c:164
#1 0x00007ffff7e3477d in examine_argument (type=type@entry=0x7fff005ed6e0, classes=classes@entry=0x7fffffffd810, in_return=in_return@entry=false, pngpr=pngpr@entry=0x7fffffffd80c, pnsse=pnsse@entry=0x7fffffffd808)
at ../src/x86/ffi64.c:359
#2 0x00007ffff7e39a0e in ffi_closure_unix64_inner (cif=<optimized out>, fun=<optimized out>, user_data=<optimized out>, rvalue=<optimized out>, reg_args=<optimized out>, argp=0x7fffffffd950 "\200\331\377\377\377\177")
at ../src/x86/ffi64.c:847
#3 0x00007ffff7e3a278 in ffi_closure_unix64 () at ../src/x86/unix64.S:303
#4 0x00007ffff7a2f50a in move_async_progress_in_main () at ../gio/gfile.c:6424
#5 0x00007ffff7ec072d in g_idle_dispatch (source=0x7fffd4002300, callback=0x7ffff7a2f4f0 <move_async_progress_in_main>, user_data=0x7fffd4001c60) at ../glib/gmain.c:6282
#6 0x00007ffff7ec3dfc in g_main_dispatch (context=0x4458c0) at ../glib/gmain.c:3476
#7 g_main_context_dispatch_unlocked (context=0x4458c0) at ../glib/gmain.c:4284
#8 0x00007ffff7f1ed58 in g_main_context_iterate_unlocked.isra.0 (context=context@entry=0x4458c0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4349
#9 0x00007ffff7ec1a73 in g_main_context_iteration (context=0x4458c0, may_block=1) at ../glib/gmain.c:4414
#10 0x00007ffff7ce854b in Gjs::MainLoop::spin(GjsContextPrivate*) (this=0x459d30, gjs=0x459c90) at ../gjs/mainloop.cpp:37
#11 0x00007ffff7cc914f in GjsContextPrivate::eval_module(char const*, unsigned char*, _GError**)
(this=0x459c90, identifier=0x599a10 "file:///var/home/andrew/Projects/gjs-guide/src/guides/gio/file-operations/gfileMove.js", exit_status_p=0x7fffffffdd7f "", error=0x7fffffffdd98) at ../gjs/context.cpp:1561
#12 0x00007ffff7cc849b in gjs_context_eval_module(GjsContext*, char const*, uint8_t*, GError**)
(js_context=0x459e10, identifier=0x599a10 "file:///var/home/andrew/Projects/gjs-guide/src/guides/gio/file-operations/gfileMove.js", exit_code=0x7fffffffdd7f "", error=0x7fffffffdd98) at ../gjs/context.cpp:1329
#13 0x0000000000402d7a in define_argv_and_eval_script(_GjsContext*, int, char* const*, char const*, unsigned long, char const*)
(js_context=0x459e10, argc=0, argv=0x7fffffffe010, script=0x4554a0 "import GLib from 'gi://GLib';\nimport Gio from 'gi://Gio';\n\nGio._promisify(Gio.File.prototype, 'move_async');\n\nconst [source] = Gio.File.new_tmp(null);\nconst target = Gio.File.new_for_path('test-move.t"..., len=376, filename=0x42bf10 "gfileMove.js") at ../gjs/console.cpp:205
#14 0x0000000000403979 in main(int, char**) (argc=3, argv=0x7fffffffdff8) at ../gjs/console.cpp:393
Expected behaviour
Callback should be invoked without crash.