Commit Graph

16041 Commits

Author SHA1 Message Date
Dan Winship
656494a784 gpermission: fix async error returns
a8eedd00 broke the error return values from
g_permission_acquire/release_async() on GSimplePermission. Fix that.
2015-08-19 15:45:11 -04:00
Matthias Clasen
8c32f7c448 Add some file monitoring tests
Add a new test which checks that atomically replacing a file that
is being monitored by GFileMonitor produced the expected events.

The test can easily be expanded to cover other file monitoring
scenarios.
2015-08-19 14:57:53 -04:00
Matthias Clasen
ac78d14125 inotify: Fix handling of paired events for atomic replace
After the big file monitoring rewrite, we only put the IN_MOVED_FROM event
in the queue for such pairs. It matches INOTIFY_DIR_MASK and thus we call
ip_dispatch_event on it, but that function was filtering it out because
the filename in the 'from' event is the one of the temp file, not the
one we are monitoring. That name is in the 'to' event, so compare it as
well, and let the event passin that case.

There is another instance of this check in glocalfilemonitor.c, which is
corrected here as well.

https://bugzilla.gnome.org/show_bug.cgi?id=751358
2015-08-19 14:57:53 -04:00
Daniel Mustieles
780b48c4cd Updated Spanish translation 2015-08-19 20:35:38 +02:00
Philip Withnall
5a642651c7 gmessages: Mention g_return_if_fail() in g_warning() and g_error() docs
It seems to be common for people to use g_warning() or g_error() as pre-
and post-condition error reporting functions, which is not really what
they’re intended for. Similarly, it is generally a sign of bad API
design to use g_warning() to report errors — use GError instead.

Try and suggest this to the user in the hope that nice code results.

https://bugzilla.gnome.org/show_bug.cgi?id=741779
2015-08-19 12:56:38 +01:00
Philip Withnall
ef1ba452b3 gsignal: Document memory management best practices for signal handlers
It’s quite common to see naked g_signal_connect() calls without a paired
g_signal_handler_disconnect(). This is commonly a bug which could lead
to uses of the callback user data after it’s been freed.

Document the best practices for avoiding this kind of bug by properly
disconnecting all signal handlers.

https://bugzilla.gnome.org/show_bug.cgi?id=741779
2015-08-19 12:56:38 +01:00
Philip Withnall
db8455f07d gmain: Document memory management best practices for GSources
It’s very common to see code where a timeout is scheduled using
g_timeout_add(), yet the owning object could be destroyed shortly
afterwards, before the timeout is fired, leading to use-after-free.

Try and prevent this happening with new code by documenting best
practices for memory management of user data for GSource callbacks.

https://bugzilla.gnome.org/show_bug.cgi?id=741779
2015-08-19 12:56:38 +01:00
Philip Withnall
c5cd1c5f02 gobject: Add cross-links from GObject reference docs to tutorials
Add some brief links from the GObject reference documentation to the
existing tutorial and overview sections on GObjects.

https://bugzilla.gnome.org/show_bug.cgi?id=743018
2015-08-19 12:54:50 +01:00
Philip Withnall
9874fe3c40 gobject: Cross-link from GType reference docs to GType conventions page
Make it a little easier to find the GType conventions page, which I
guess should be the canonical guide to how to name things.

This adds a brief mention of the valid characters in a type name to the
conventions page.

https://bugzilla.gnome.org/show_bug.cgi?id=743018
2015-08-19 12:54:50 +01:00
Dušan Kazik
10f96a914d Updated Slovak translation 2015-08-19 10:59:44 +00:00
Philip Withnall
d624bf4e66 gthread: Suggest using *_async() functions instead of threads
It’s unfortunately common to see worker threads being spawned all over
the place to do operations which could be brought into the main thread
with an async call, simplifying everything.

https://bugzilla.gnome.org/show_bug.cgi?id=741779
2015-08-19 11:38:55 +01:00
Philip Withnall
5ee333e4cb gstrfuncs: Add a string formatting note about using G_GUINT64_FORMAT
…and friends. The ‘String precision pitfalls’ section is already linked
to from all the relevant printf()-style functions, so this documentation
should hopefully be easy to find.

https://bugzilla.gnome.org/show_bug.cgi?id=741779
2015-08-19 11:36:43 +01:00
Philip Withnall
8c858a018d gvariant: Clarify that nullable strings should use maybe types
Otherwise people might try to encode a NULL string as "NULL". I’m not
even kidding.

https://bugzilla.gnome.org/show_bug.cgi?id=741779
2015-08-19 11:36:43 +01:00
Janusz Lewandowski
5d014a802a Add a g_dbus_connection_register_object_with_closures function
This is a binding-friendly version of g_dbus_connection_register_object.
Based on a patch by Martin Pitt and the code of g_bus_watch_name_with_closures.

https://bugzilla.gnome.org/show_bug.cgi?id=656325
2015-08-18 16:41:12 -04:00
Alexandre Franke
61254347b1 Updated French translation 2015-08-15 11:36:48 +00:00
Kjartan Maraas
23d8cc5763 Updated Norwegian bokmål translation. 2015-08-11 19:41:08 +02:00
Jordi Mas
66116fc272 Update Catalan translation 2015-08-11 08:05:34 +02:00
Felix Riemann
34277d6996 gio: g_menu_item_set_icon should not fail if icon is NULL
It allows passing a NULL icon to unset the icon and thus should not
log a critical warning if used like that.

https://bugzilla.gnome.org/show_bug.cgi?id=753285
2015-08-10 19:00:24 +02:00
Muhammet Kara
0993cf6dc0 Updated Turkish translation 2015-08-09 15:46:12 +00:00
Dan Winship
a8eedd00a7 gio: fix a leftover GSimpleAsyncResult usage
And remove remaining unnecessary gsimpleasyncresult.h includes
2015-08-07 09:50:16 -04:00
Dan Winship
e02fa68068 gsettings-tool: fix deprecated call 2015-08-07 09:50:13 -04:00
Dan Winship
ff3dee4bf6 gdbus: fix gdbus-exit-on-close for gdbusconnection change 2015-08-07 09:49:57 -04:00
Dan Winship
a366053253 glib: remove deprecated g_mem_is_system_malloc() check in gprintf.c 2015-08-07 09:49:50 -04:00
Dan Winship
ebaa1de304 glib: drop array-test test for bug 568760
The test relied on g_mem_set_vtable(), so it fails now. But no one
ever touches that code so it's not like we're going to break it again
anyway.
2015-08-07 09:49:35 -04:00
Aurimas Černius
a0e74f6033 Updated Lithuanian translation 2015-08-06 22:53:12 +03:00
Colin Walters
66bc9660c4 gdbusconnection: Don't g_printerr() when exiting
exit-on-close for a DBus connection is a completely normal thing.  On
a regular GNOME login, gdm retains the X server, but terminates the
session login bus and associated helpers like gnome-settings-dameon,
the a11y tools, etc.

I've seen several downstream reports of confusion as to what these
apparent error messages mean in the system log.  It doesn't help
that they're so obtuse.

We're also printing them to stderr, when this is not an error.

The reason this was introduced is presumably some people were confused
as to why their process exited when the system bus did.  But the
solution for that I believe is documentation, not printing stuff to
everyone's system log in normal operation.

https://bugzilla.gnome.org/show_bug.cgi?id=742386
2015-08-06 08:51:02 -04:00
Matthias Clasen
905e916573 Don't leak an error
The previous commit introduced a possible memory leak in cases
where we get a G_IO_ERROR_CLOSED error. Make sure to always
free an error, if we got one.

https://bugzilla.gnome.org/show_bug.cgi?id=753278
2015-08-05 17:18:48 -04:00
Stef Walter
b3fcb1442e gdbus: Don't use g_assert_no_error() GDBusObjectManagerServer
There are real world cases where emitting signals can fail, such
as if the DBus connection closes. Asserting and aborting the process
in these cases is just plain lazy.

Ignore the errors when the connection is closed, and turn the
others into warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=753278
2015-08-05 13:43:08 +02:00
Andika Triwidada
46cf19c447 Updated Indonesian translation 2015-08-03 11:28:22 +00:00
Benjamin Otte
a2a3587036 gmain: Document return value of GSourceFuncs.dispatch 2015-08-02 17:37:12 +02:00
Philip Withnall
6b652b1a2e gio: Fix application of GNetworkMonitor:network-metered patch
The wrong patch from https://bugzilla.gnome.org/show_bug.cgi?id=750282
was applied, causing test failures due to not implementing the property
on GNetworkMonitorBase (plus some other omissions).

Fix that by reverting commit a80e7db1a8
and re-applying the correct patch over the top.

https://bugzilla.gnome.org/show_bug.cgi?id=750282
2015-07-29 11:58:02 +01:00
Philip Withnall
7f195ac956 gresource: Clarify error docs for g_resource_enumerate_children()
Document that it returns G_RESOURCE_ERROR_NOT_FOUND if the path doesn’t
exist.
2015-07-28 10:14:17 +01:00
Akom Chotiphantawanon
6e4e1c168c Updated Thai translation 2015-07-28 15:55:05 +07:00
Matthias Clasen
b173244b7d Remove malloc tests
These tests were about the no longer supported
vtable functionality, so just remove them.
2015-07-28 00:04:35 -04:00
Alexander Larsson
3be6ed60aa Deprecate and drop support for memory vtables
The memory vtables no longer work, because glib contructors are called
before main(), so there is no way to set it them before use. This stops using
the vtable at all, and deprecates and stubs out the related functions.

https://bugzilla.gnome.org/show_bug.cgi?id=751592
2015-07-27 23:30:20 -04:00
Matthias Clasen
08a3f3f3d2 GOptionContext: Don't crash without main group
This was introduced in 126c685f4a and caused e.g. gdbus
to crash when called without arguments.

https://bugzilla.gnome.org/show_bug.cgi?id=752210
2015-07-27 07:53:40 -04:00
Matthias Clasen
17871e6881 Add a note to the g_str_hash docs
Point out some shortcomings of the djb hash, as found in

https://bugzilla.gnome.org/show_bug.cgi?id=751610
2015-07-27 06:51:17 -04:00
Richard Hughes
a80e7db1a8 gio: Add network metered information to GNetworkMonitor
Add a property to GNetworkMonitor indicating if the network
is metered, e.g. subject to limitations set by service providers.

The default value is FALSE

https://bugzilla.gnome.org/show_bug.cgi?id=750282
2015-07-27 06:44:52 -04:00
Matthias Clasen
9c4887027d Remove some questionable documentation
A function that takes a lock can certainly block in the sense
that it has to wait if the lock is taken.

https://bugzilla.gnome.org/show_bug.cgi?id=751751
2015-07-27 06:42:46 -04:00
Matthias Clasen
c885d42751 Add tests for GApplication::handle-local-options 2015-07-26 21:41:08 -04:00
Christophe Fergeau
243d740c04 gapplication: Stop handle-local-options emission on errors
A signal accumulator can return TRUE to continue signal emission, and
FALSE to stop signal emission. handle-local-options callbacks can return
« return a non-negative option if you have handled your options and
want to exit the process ».

Currently, g_application_handle_local_options_accumulator (the
accumulator for the handle-local-options signal) returns TRUE on
non-negative return value (ie continue signal emission), and returns
FALSE on negative return values (ie when the default option processing
should continue).
This return value seems backward as on >= 0 values, subsequent
handle-local-options callbacks could overwrite the 'exit request' from
the handler, while on < 0 values, the handle-local-options processing
could end up early if several callbacks are listening for this signal.
In particular, the default handler for this signal
(g_application_real_handle_local_options) always returns -1 and will
overwrite >= 0 return values from other handlers.

This commit inverts the check so that signal emission stops early when
one of the handle-local-options callbacks indicates it wants processing
to stop and the process to exit.

https://bugzilla.gnome.org/show_bug.cgi?id=751598
2015-07-26 21:41:08 -04:00
Christophe Fergeau
2551685cf6 gapplication: Fix typos in handle-local-options API doc
The @options parameter was missing an 's', and the name of
g_application_command_line_get_options_dict() was not correct.

https://bugzilla.gnome.org/show_bug.cgi?id=751598
2015-07-26 21:41:08 -04:00
Marek Černocký
c7e49a3241 Updated Czech translation 2015-07-25 03:27:32 +02:00
Peter Meerwald
0441ae1ccf ghash: Fix typo in g_hash_table_replace() documentation
https://bugzilla.gnome.org/show_bug.cgi?id=752767
2015-07-24 12:41:01 -04:00
Philip Withnall
8520ae3ffa gsocket: Factor out blocking parameter from g_socket_send_messages()
This will make future API additions easier. The factored version is
internal for the time being.

https://bugzilla.gnome.org/show_bug.cgi?id=751924
2015-07-23 11:37:18 +01:00
TingPing
b65287fea5 win32: Fix leak in g_win32_get_command_line()
https://bugzilla.gnome.org/show_bug.cgi?id=741822
2015-07-23 04:22:59 -04:00
TingPing
3cc349b04e win32: Replace usage of __wgetmainargs()
It was an internal function that has been removed with VS 2015

Use g_win32_get_command_line() or CommandLineToArgvW() directly.

https://bugzilla.gnome.org/show_bug.cgi?id=741822
2015-07-23 04:22:59 -04:00
Arun Raghavan
be7de8a7fd gdbusconnection: Fix signal subscription documentation
https://bugzilla.gnome.org/show_bug.cgi?id=752656
2015-07-21 15:20:23 -04:00
Chun-wei Fan
53d487e31b config.h.win32.in: Clean Up and Update
Merge the parts that has things to do with stdint.h and inttypes.h with
the !_MSC_VER portions, and add initial support for Visual Studio 2015,
which added support for C99 snprintf() and vsnprintf().

Not too sure about the !_MSC_VER for C99 snprintf() and vsnprintf(), but
since this file is mainly for Visual Studio builds, anyways...
2015-07-21 11:26:29 +08:00
Matthias Clasen
ab3805ab04 2.45.4 2015-07-20 17:45:43 -04:00