After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 664415 - Gio: file.copy does not allow null for progress_callback parameter
Gio: file.copy does not allow null for progress_callback parameter
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2011-11-20 12:51 UTC by carlo.teubner
Modified: 2015-02-07 16:49 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description carlo.teubner 2011-11-20 12:51:42 UTC
Try this e.g. in looking glass:

f = Gio.file_new_for_path("some_existing_file")
g = Gio.file_new_for_path("nonexistent_file")
f.copy(g, 0, null, null, null)

This gives:

Error: Error invoking Gio.copy: Invalid callback given for argument progress_callback

I've verified that this is a problem with gjs and not gio by trying the equivalent C program -- it works.

Workaround is to use

f.copy(g, 0, null, function () {}, null)
Comment 1 carlo.teubner 2011-11-20 12:52:41 UTC
This used to work in whichever gjs came with Fedora 15 -- it's now broken in Fedora 16.
Comment 2 Giovanni Campagna 2011-11-20 13:16:26 UTC
(In reply to comment #1)
> This used to work in whichever gjs came with Fedora 15 -- it's now broken in
> Fedora 16.

Funny. If so, we had a bug in the previous version
In fact, looking at glib code, progress_callback is not annotated (allow-none), therefore gjs does not allow null.
If NULL is a valid value in C, then the bug is in glib. Reassigning.
Comment 3 carlo.teubner 2011-11-20 13:34:56 UTC
In that case, there's also a bug in the Gio docs:

http://developer.gnome.org/gio/2.30/GFile.html#g-file-copy

"If progress_callback is not NULL, then the operation can be monitored by setting this to a GFileProgressCallback function. "

Implies that it may be NULL.
Comment 4 André Klapper 2015-02-07 16:49:25 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]