Commit Graph

13992 Commits

Author SHA1 Message Date
Colin Walters
d8874e58a7 gtester: Use FD_CLOEXEC when creating pipes
We were already unsetting the cloexec flag for the child later,
just not actually starting with it.

https://bugzilla.gnome.org/show_bug.cgi?id=692404
2013-01-23 12:23:51 -05:00
Dan Winship
5932e16acd GNetworkMonitorNetlink: make the netlink socket cloexec
Use the same code GSocket does, to try SOCK_CLOEXEC first, and then
fall back to FD_CLOEXEC if it fails. (And fix that code to not call
fcntl if SOCK_CLOEXEC worked.)

https://bugzilla.gnome.org/show_bug.cgi?id=692332
2013-01-23 08:48:32 -05:00
Shankar Prasad
2476dd24d7 Updated kn translations 2013-01-23 12:59:13 +05:30
Chun-wei Fan
bfc9536617 build/Makefile-newvs.am: Make description comment clearer 2013-01-22 14:14:27 +08:00
Cosimo Cecchi
e908b50371 gfile: don't report completion twice on g_file_load_contents error
When an error occurs while reading the file input stream in
g_file_load_contents (e.g. because the operation was cancelled), the
code is correctly calling g_task_return_error(), but in the callback
from the close operation, g_task_return_boolean() will be called again.

Code that cleans up its state in the async callback will then be called
twice, leading to invalid memory access.

https://bugzilla.gnome.org/show_bug.cgi?id=692202
2013-01-21 10:36:42 -05:00
Cosimo Cecchi
40f8e15c1b inotify: fix a memleak
https://bugzilla.gnome.org/show_bug.cgi?id=692201
2013-01-21 09:51:09 -05:00
Kjartan Maraas
0934230007 Updated Norwegian bokmål translation 2013-01-21 12:25:16 +01:00
Giovanni Campagna
1ce415b45b Install an invalidation notifier for GClosure in g_source_set_closure()
The point of g_source_set_closure() is getting memory management right,
including handling closures disappearing from the outside (for example
because a runtime they refer to is being shutdown). This means that
sources with an associated closure should remove themselves from the
main loop and free memory when the closure is invalidated.

https://bugzilla.gnome.org/show_bug.cgi?id=692034
2013-01-20 16:23:32 +01:00
Gheyret Kenji
e68402e330 Updated Uyghur translation
Signed-off-by: Gheyret Kenji <gheyret@gmail.com>
2013-01-20 19:47:16 +09:00
Matthias Clasen
287849a1ee Fix a typo 2013-01-20 03:16:47 -05:00
Matthias Clasen
89aa9dbd98 Fix g_test_add_vtable
This function was creating a test suite for each added
testcase, when it should have grouped tests according to
their paths.
2013-01-20 03:14:24 -05:00
Matthias Clasen
1cd0cf3797 Fix annotation for g_test_fail
The doc comment has a "Since: 2.30" annotation, so make
the header match that.
2013-01-20 03:12:09 -05:00
Matthias Clasen
9e9d028b96 Fix build with -Werror=format
There were a few places in gmarkup.c where we were giving
pointer differences when integers are expected. Fix that
by explicitly casting to int.

https://bugzilla.gnome.org/show_bug.cgi?id=692079
2013-01-19 14:30:05 -05:00
Ryan Lortie
6af8894003 fam: implement gio-nfs-{file,directory}-monitor
Declare explicit support for monitor NFS from the fam file monitoring
backend.  This will cause it to be preferred for monitoring on NFS, if
it is installed.

https://bugzilla.gnome.org/show_bug.cgi?id=592211
2013-01-19 14:04:49 -05:00
Ryan Lortie
6be54e9f56 localfile: add support for monitoring on NFS
Add a pair of new extension points: 'gio-nfs-file-monitor' and
'gio-nfs-directory-monitor'.

Add a check to GLocalFile when creating a file monitor.  If the
requested file is in the user's home directory and the user has an NFS
home directory then attempt to use an implementation of one of the new
extension points.  If we don't have any implementations then fall back
to the normal "local" monitors.

https://bugzilla.gnome.org/show_bug.cgi?id=592211
2013-01-19 14:04:49 -05:00
Ryan Lortie
c83600e8ae file monitors: use new giomodule function
Get rid of the complicated default module detection code in
GLocalFileMonitor and GLocalDirectoryMonitor and use the new
_gio_module_get_default_type() function instead.

This change also adds the ability to override the default file monitor
via the GIO_USE_FILE_MONITOR environment variable in the same way as can
be done for GIO_USE_VFS.

https://bugzilla.gnome.org/show_bug.cgi?id=592211
2013-01-19 14:04:49 -05:00
Ryan Lortie
3a7b44c007 giomodule: add a new "get default" function
_gio_module_get_default() is a very convenient function for modules
implementing a singleton -- it finds the default module by priority
subject to override by a given environment variable name, instantiates
it, and caches the instance for future calls.  It also has the ability
to query instances for being 'active' using a callback.

It doesn't work very well for non-singletons (like file monitors).

Add a new function _gio_module_get_default_type() that skips the
instantiation, returning the GType instead.  As a replacement for the
'active' callback, a vtable offset can be given for a virtual function
to use to query if a particular backend is supported.

https://bugzilla.gnome.org/show_bug.cgi?id=592211
2013-01-19 14:04:49 -05:00
Chun-wei Fan
ca58dae277 Update Visual C++ 2010 property sheet
Left out some items to purge in the last commit.  Sorry :|
2013-01-19 12:05:12 +08:00
Chun-wei Fan
6c7539fe59 Clean up Visual C++ property sheets
We no longer need entries to generate the .def files in the property sheets
as we are now doing __declspec (dllexport) to export all the needed
symbols.  So, purge these items from the property sheets since they are no
longer used.
2013-01-19 12:02:45 +08:00
Chun-wei Fan
bdb7c2d956 Bug 688681: Stop using the .def file for GThread Visual C++ builds
We should also stop using gthread/gthread.def file as well, since we
also use __declspec (dllexport) for the two (deprecated) functions there
since commit f8756694.

This should also silence some linker warnings in x64 builds.

Also get rid of the references to the .symbols files in the
.vcxproj.filters(in) in the various Visual C++ 2010 projects
2013-01-19 11:58:47 +08:00
Cosimo Cecchi
13966e0fad timezone: plug a memleak 2013-01-18 17:22:52 -05:00
Cosimo Cecchi
f24594122c timezone: avoid a double GBytes unref
This will cause random memory corruption; functions should not unref
passed-in parameters.
2013-01-18 17:09:31 -05:00
Мирослав Николић
4d3bb3caf7 Updated Serbian translation 2013-01-18 23:01:19 +01:00
Ryan Lortie
998c6e65cf GVariant: fix normal-form checking for tuples
GVariant has the concept of fixed-sized types (ie: types for which all
values of the type will have the same size).  Examples are booleans,
integers, doubles, etc.  Tuples containing only these types are also
fixed size.

When GVariant is trying to deal with a fixed-sized value for which it
doesn't have a sufficient backing store (eg: the case where a
fixed-sized value was created with g_variant_new_data() with an
incorrect number of bytes) it denotes this by setting the size of the
value to the correct fixed size but using a NULL data pointer.

This is well-documented in several code comments and also in the public
API documentation for g_variant_get_data() which describes the situation
number which NULL could be returned.

The decision to deal with this case in this way was changed at the last
minute around the time that GVariant was merged -- originally we had an
elaborate setup involving allocating an internal buffer of sufficient
size to be shared between all invalid values.

Unfortunately, when making this change a small detail was missed.
gvs_tuple_get_child() (the function responsible for deserialising
tuples) was updated to properly check for this case (and it contains a
comment about why it must).  gvs_tuple_is_normal() (the function
responsible for verifying if a tuple is in normal form) was not.

We add the check now.

Note that this problem does not exist with any other container type
because tuples are the only container capable of being fixed-sized.  All
other container types (arrays, maybes, variants) can contain a variable
number of items or items of variable types (note: we consider dictionary
entries to be two-tuples).  The code for validating non-container values
also contains a check for the case of NULL data.

The problem also does not occur in the only other function dealing with
serialised tuples: gvs_tuple_n_children().  Whereas other container
types would have to inspect the serialised data to determine the number
of children, for tuples it can be determined directly from the type.
2013-01-18 16:27:13 -05:00
Ryan Lortie
00ee6de4e2 gobject/: Remove abicheck.sh from DIST_EXTRA 2013-01-18 14:33:16 -05:00
Ryan Lortie
614f6c5e70 Add new API checking utility
Add a test script to make sure that (with a few exceptions) only symbols
that start with 'g_' are being exported from our public libraries.

https://bugzilla.gnome.org/show_bug.cgi?id=692029
2013-01-18 13:57:07 -05:00
Ryan Lortie
52a81a7d86 Remove a few more G_GNUC_INTERNAL users 2013-01-18 13:28:43 -05:00
Ryan Lortie
346aa683de Fix visibility for glib/ and gio/ submodules
We have various sub directories in glib/ and gio/ (eg: inotify, gnulib,
pcre, xdgmime, etc.) that build convenience libraries that are then
included into libglib and libgio.  The files in these directories need
to be built with the same visibility policy as the files in the first
level directories, so add CFLAGS for them all.

This wasn't a problem when the visibility flags were set directly in
CFLAGS but then we had to deal with some modules that we built that we
explicitly wanted to export symbols from.

For now, we can keep things the way they are because it's less hacky and
although it's a theoretical hazard to forget these CFLAGS, we rarely add
new subdirectories to the build.
2013-01-18 13:23:40 -05:00
Colin Walters
6f8f1f7097 Remove most use of G_GNUC_INTERNAL
Now that we use an explicit list of symbols to export, the
G_GNUC_INTERNAL is redundant.

https://bugzilla.gnome.org/show_bug.cgi?id=688681
2013-01-18 13:03:28 -05:00
Ryan Lortie
dbf447292d Remove ABI checking scripts
Before this commit, the only difference between the expected and actual
ABI were the addition of _init and _fini symbols in each module (now
that regexp-based export control is not catching those).
2013-01-17 10:50:18 -05:00
Ryan Lortie
304950a7ac Remove regexp-based export control 2013-01-17 10:49:37 -05:00
Ryan Lortie
d89fb7bf10 gsignal: fix closure invalidation code
This is the bug that has been causing segfaults and criticals when accel
keys are used to close windows via GtkUIManager.

The main cause of this problem was a mistake made in the original patch
when modifying the handler_lookup() to take the extra 'closure'
parameter.  The original check used was:

    if (handler->sequential_number == handler_id ||
       (closure && handler->closure == closure))

It was called to find a particular closure like so:

    handler_lookup (instance, 0, closure, &signal_id);

The problem is that the check will return if either the signal ID or
closure matches (if a closure was given).  The calling code assumes 0 to
be an invalid signal ID which will match no handlers, but unfortunately
the rest of gsignal code uses this to denote a signal that has already
been disconnected.  The result is that this function was searching for a
matching closure _or_ the first already-disconnected handler.  When it
found the already-disconnected handler, we'd get criticals and crashes.

The condition has been corrected; it now ignores the handler_id
parameter if the closure parameter is non-NULL.

While we're in here, change the lifecycle of the invalidation notify to
be easier to understand.

Before, the notify was removed when the last reference on the handler
dropped.  This could happen in very many situations; often at the end of
an emission.  Instead, we now tie the registration of the notifier to
the lifecycle of the signal connection.  When the signal is disconnected
we remove the notification, even if other references are held (eg:
because it is currently being dispatched).

https://bugzilla.gnome.org/show_bug.cgi?id=690118
2013-01-16 23:04:11 -05:00
Dan Winship
578b657f95 gio/tests: add some more async stream tests
Add read_async() and skip_async() tests to buffered-input-stream.

Fix and re-enable filter-streams's existing close_async() tests, and
add read_async(), skip_async(), and write_async() tests as well. Also,
redo the tests to use dummy GFilterInputStream and GFilterOutputStream
subclasses rather than GBufferedInput/OutputStream, so that we're
testing the base filter stream implementations of everything (since
the buffered stream overrides are already getting tested in the
buffered-input-stream and buffered-output-stream tests anyway).

Add a skip_async() test to unix-streams. (This one would crash without
the bugfix in the previous commit.)
2013-01-16 10:17:15 -05:00
Alban Browaeys
acfa6e2337 gio: callback_data is the task not the task data.
skip_callback_wrapper expect the user_data (callback_data)
to be the task holding the task_data, not the task_data
itself.
Otherwise the task_data is cast as GTask and then task_data
is extracted from this bogus task.

https://bugzilla.gnome.org/show_bug.cgi?id=691812
2013-01-16 10:12:46 -05:00
Ryan Lortie
e1517ca82d mainloop test: fix a silly memory error 2013-01-15 15:40:14 -05:00
Ryan Lortie
46b15bb581 mainloop test: use atomic for cross-thread access 2013-01-15 15:40:09 -05:00
Ryan Lortie
42c2c4f67d mainloop test: fix a small typo
This g_assert() could never possibly fail, as it was.
2013-01-15 15:22:35 -05:00
Ryan Lortie
83e5d169d6 tests for the new MainContext/GSource API 2013-01-15 14:08:02 -05:00
Ryan Lortie
6d1a663609 Add a UNIX fd source
https://bugzilla.gnome.org/show_bug.cgi?id=658020
2013-01-15 14:08:02 -05:00
Ryan Lortie
cbf68cb22d gsource: Add support for file descriptors on UNIX
Adding file descriptors to a GSource provides similar functionality to
the old g_source_add_poll() API with two main differences.

First: the list of handles is managed internally and therefore users are
prevented from randomly modifying the ->events field.  This prepares us
for an epoll future where changing the event mask is a syscall.

Second: keeping the list internally allows us to check the ->revents for
events for ourselves, allowing the source to skip implementing
check/prepare.  This also prepares us for the future by allowing an
implementation that doesn't need to iterate over all of the sources
every time.

https://bugzilla.gnome.org/show_bug.cgi?id=686853
2013-01-15 14:08:02 -05:00
Ryan Lortie
db7d5306cc GTimeoutSource: simplify
Take advantage of the new default handling of the 'prepare' and 'check'
functions.

https://bugzilla.gnome.org/show_bug.cgi?id=657729
2013-01-15 14:08:02 -05:00
Ryan Lortie
768574635d GSource: new API g_source_set_ready_time()
Add an API to mark a GSource to automatically become ready at the
specified monotonic time.

https://bugzilla.gnome.org/show_bug.cgi?id=657729
2013-01-15 14:08:02 -05:00
Ryan Lortie
6d25e34998 gsource: allow NULL check and prepare functions
Allow for NULL GSourceFuncs.check() and .prepare().

For prepare() the source will be taken not to be ready and having an
infinite timeout.  For check() the source will be taken not to be ready.

https://bugzilla.gnome.org/show_bug.cgi?id=686853
2013-01-15 14:08:02 -05:00
Ryan Lortie
8f7f7f6c42 move GIOCondition to gmain.h from giochannel.h
GIOCondition has uses outside of GIOChannel, so move it to gmain.h.

https://bugzilla.gnome.org/show_bug.cgi?id=686853
2013-01-15 14:08:02 -05:00
Ryan Lortie
ed8ec635eb gsource: Make GSource->source_funcs const
This is the vtable pointer for the source which is usually held in
static storage.  For our internal sources it points at a vtable which
the user should really never be modifying.

Mark it const.

https://bugzilla.gnome.org/show_bug.cgi?id=686853
2013-01-15 14:08:01 -05:00
Yuri Sedunov
e1bee17e94 gtester: Add #include config.h
Missed #include "config.h" so, in particular, large file support
(_FILE_OFFSET_BITS) ignored.

https://bugzilla.gnome.org/show_bug.cgi?id=691624
2013-01-15 11:05:43 -05:00
Chun-wei Fan
38229d47d1 Revert "Improvde #include order consistency"
This reverts commit f2e00a07f4.

Moving the block up would prevent G_OS_WIN32 being checked correctly as
it is a macro that is defined by including the GLib header(s), at least for
Visual C++ builds.

https://bugzilla.gnome.org/show_bug.cgi?id=691769
2013-01-15 19:35:52 +08:00
Chun-wei Fan
4ba56f3653 Bug 688681: Stop using .def files in Visual Studio builds
Since we are now starting to use __declspec (dllexport) to export the
public functions during the build of the GLib DLLs (i.e. to generate the
.lib files), we don't want to generate the .def files from the .symbols
files as we did before for a long time.

This removes from the projects the custom build steps to generate the
various .def files

This will also update the pre-configured config.h(.win32.in) to define
_GLIB_EXTERN appropriately as __declspec (dllexport), as well as making its
entries reflect config.h.in more closely.
2013-01-15 15:23:05 +08:00
Matthias Clasen
c4d8eafd00 Bump version 2013-01-15 00:24:27 -05:00
Matthias Clasen
61539f735a 2.35.4 2013-01-14 23:52:10 -05:00