Commit Graph

14368 Commits

Author SHA1 Message Date
Stef Walter
b33fabd585 gatomicarray: Support for cleaning up
Cleanup atomic array manually as very last thing
Otherwise we keep putting stuff in freelist during cleanup.

Initial work by: Dan Winship <danw@gnome.org>

https://bugzilla.gnome.org/show_bug.cgi?id=711778
2013-11-13 09:45:55 +01:00
Stef Walter
11dc3eedb5 gobject: Define a cleanup scope for libgobject
https://bugzilla.gnome.org/show_bug.cgi?id=711778
2013-11-13 09:45:16 +01:00
Stef Walter
b32ca195a6 gmodule: Cleanup main_module, ie: self
https://bugzilla.gnome.org/show_bug.cgi?id=711767
2013-11-13 09:45:14 +01:00
Stef Walter
c9d6518969 gthreadpool: Cleanup thread pool unused threads
This requires different phases getting involved:
 * early: Signal all the unused pool threads, and change unused
   limits to zero, so no new unused pool threads.
 * default: Join all unused pool threads.
 * late: Free up the unused thread queue

https://bugzilla.gnome.org/show_bug.cgi?id=711744
2013-11-13 09:44:21 +01:00
Stef Walter
2361bf79ca threadpool-test: Cleanup memory in test
https://bugzilla.gnome.org/show_bug.cgi?id=711744
2013-11-13 09:42:26 +01:00
Stef Walter
11394e78bb sources: Fix leaks in tests
https://bugzilla.gnome.org/show_bug.cgi?id=711751
2013-11-13 09:40:31 +01:00
Stef Walter
26d7b74e51 slice: Don't run GSlice tests under valgrind
https://bugzilla.gnome.org/show_bug.cgi?id=711744
2013-11-13 09:40:25 +01:00
Stef Walter
44c5542eab 642026: Run less locking iterations under valgrind
Otherwise these tests are prohibitively slow.  Under valgrind the
same race conditions aren't likely to show up anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=711744
2013-11-13 09:40:19 +01:00
Stef Walter
21698230c3 gmessages: Initialize GPrivate so it gets cleaned up
https://bugzilla.gnome.org/show_bug.cgi?id=711744
2013-11-13 09:40:18 +01:00
Stef Walter
425d7b7fae gcleanup: Hook up more libglib globals to cleanup
https://bugzilla.gnome.org/show_bug.cgi?id=711744
2013-11-13 09:38:53 +01:00
Stef Walter
75a458a9b4 glib: Define cleanup lists for glib tests
This allows G_CLEANUP to be used in the tests, and from things
like G_PRIVATE_INIT and so on.

https://bugzilla.gnome.org/show_bug.cgi?id=711744
2013-11-13 09:36:01 +01:00
Stef Walter
530f4930bf option-context: Fix leaks in tests
https://bugzilla.gnome.org/show_bug.cgi?id=627423
2013-11-13 09:35:47 +01:00
Stef Walter
d7987752a5 gcleanup: Add in more gtestutils.c cleanups
https://bugzilla.gnome.org/show_bug.cgi?id=711744
2013-11-13 09:34:48 +01:00
Ryan Lortie
9b6678b866 GThread posix: add impl structs to cleanup list
There are two ways of using the structs like GMutex, GCond, etc.

The first is to explicitly _init() and _clear() them.  This is when you
use them as part of another structure.  This case is not interesting for
gcleanup.

The other is to have them in static storage (zero-filled) and just use
them for the first time.  This is the difficult case, because we don't
ever free the impl in that case.

In the first case, the impl is created and set in the _init() function.
We can therfore tell that we are in the second case if we get to the
get_impl() function and the impl is not there yet.  In that case, add it
to the cleanup list.

There are probably people that allocate a GMutex as part of a
zero-filled structure and use it, then call g_mutex_clear() on it.  This
is technically a violation of the API and these users will crash with
G_DEBUG=cleanup, but that's a good thing because it will cause them to
fix their code.

All threading primitives are cleaned up on the graveyard shift, so that
they can be used by other cleanup functions is libglib.

Because GPrivate has a callback, and we need to run that callback for
the main thread, we schedule two cleanups for it. The cleanup needs
to run in the cleanup scope where the GPrivate callback is defined,
so adapt G_PRIVATE_INIT to do this.

Tweaked by: Stef Walter <stefw@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=711744
2013-11-13 09:34:35 +01:00
Stef Walter
d7747a1454 gthread-posix: Don't use gslice allocated GRecMutex
This leads to problems during cleanup, and seems strange
to have locks defined in terms of things that need locking.

https://bugzilla.gnome.org/show_bug.cgi?id=711753
2013-11-13 09:26:05 +01:00
Stef Walter
b9c11b1a85 memcheck: Add a 'make memcheck' target that runs valgrind
Checks for memory errors and leaks

https://bugzilla.gnome.org/show_bug.cgi?id=711744
2013-11-13 09:25:18 +01:00
Ryan Lortie
fc1a1cd681 Make some use of G_CLEANUP
This is enough to get a few testcases running with zero memory in use at
the end.

Tweaked by: Stef Walter <stefw@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=711744
2013-11-13 09:24:59 +01:00
Stef Walter
6f5c379d59 WIP cleanup for qdata 2013-11-13 09:19:35 +01:00
Stef Walter
81a2133a72 gcleanup: Implementation of GCleanupScope and associated macros
Add a new type GCleanupScope that stores a list of things to "clean up"
when g_cleanup_clean() is called.

More importantly, define some macros (G_CLEANUP, etc) that
facilitate conditionally building a per-library/executable cleanup list
if G_DEBUG=cleanup is specified.  The cleanup list is run at destructor
time.

-DG_CLEANUP_SCOPE defines the name of the cleanup list and enables the
feature for a given module.

Concept and initial work: Ryan Lortie <desrt@desrt.ca>

https://bugzilla.gnome.org/show_bug.cgi?id=627423
2013-11-13 09:19:28 +01:00
Ryan Lortie
21cf219cf6 gconstructor: install as a proper header
https://bugzilla.gnome.org/show_bug.cgi?id=627423
2013-11-12 20:54:10 +01:00
Ryan Lortie
d33f758313 bump version 2013-11-12 00:19:50 -05:00
Ryan Lortie
00d980f6f4 GLib 2.39.1 2.39.1 2013-11-12 00:05:09 -05:00
Ryan Lortie
ce35c08c57 Revert "gdbus-connection-loss: Fix leak in test"
This reverts commit 670379b26f.

This is causing distcheck to fail and will have to be revisited later.
2013-11-12 00:05:09 -05:00
Ryan Lortie
5c4f3f4dab gsettings test: fix srcdir != builddir
Just copy the schemas to the builddir and compile them in place instead
of trying to mess around with creating the compiled file in a different
dir.  This solves issues in the summary/description testcase when
GSettings expects the usual situation of having the .xml files present
in the same directory.
2013-11-12 00:05:04 -05:00
Stef Walter
1e5e3b64a8 gsubprocess: Fix a number of leaks and a segfault
Fixed a number of leaks in gsubprocess, as well as a segfault
that was hidden by never calling g_subprocess_communicate_state_free().

https://bugzilla.gnome.org/show_bug.cgi?id=711803
2013-11-11 17:41:39 +01:00
Stef Walter
d10f35310f threadpool-test: Fix leaks in tests
https://bugzilla.gnome.org/show_bug.cgi?id=711751
2013-11-11 17:37:48 +01:00
Stef Walter
3e041ce5ad mainloop-test: Fix uninitialized memory access in tests
https://bugzilla.gnome.org/show_bug.cgi?id=711751
2013-11-11 17:35:26 +01:00
Stef Walter
a638be8a79 Revert "giomodule: Fix leaks in module loading"
This reverts commit dc72039c16.

This depends on a patch that allows GTypeModule to be finalized.
Lets put this back in bugzilla until that gets in.
2013-11-11 17:17:10 +01:00
Stef Walter
aa7ec15091 Revert "defaultiface: Fix leak in test"
This reverts commit fd7b2faa64.

This required another patch to be commited first. Will put this
back in bugzilla.
2013-11-11 17:06:38 +01:00
Chun-wei Fan
f038c629a4 glib/tests/: Avoid GCCisms and fix tests for MSVC
Skip the tests on inf/nan strings for the gvariant and strfuncs tests, and
skip the hex strings for the strtod tests in strfuncs as they are C99
features that are not yet supported by Visual C++ (even 2013).  Use a
definition for NAN and INFINITY (that is also used in PyGObject) as
atof("NaN") and atof("Infinity") simply returns 0.0 (which is not a NAN)
in Visual C++ to fix the tests running there.

Also adapt to the format of g_ascii_formatd() when dealing with 1e99.

https://bugzilla.gnome.org/show_bug.cgi?id=711047
2013-11-11 22:52:00 +08:00
Chun-wei Fan
0212ab6182 Tests: Fix up the expected messages
There was an expected messages that was not in the form that GLib on
Windows actually produces, which causes some test to fail.  Fix this up.

https://bugzilla.gnome.org/show_bug.cgi?id=711047
2013-11-11 22:40:57 +08:00
Chun-wei Fan
c58a7b8c74 tests: Fix for non-GCC
Remove uses of using empty arrays in initialization and structs, and build
tests that rely on GCCisms on GCC only.

https://bugzilla.gnome.org/show_bug.cgi?id=711047
2013-11-11 22:39:57 +08:00
Chun-wei Fan
a7707ec60b glib/tests/spawn-singlethread: Improve test for Windows
Use a Windows-style .bat script for the test_spawn_script() test, at least
when the code is built with Visual C++ (due to differences in how scripts
are written for shells and Windows cmd.exe), and account for Windows-style
line endings for that test too.

Let the MinGW builds (which are normally done in an MSYS BASH-style shell) continue to use the
*NIX-style script for that test.

https://bugzilla.gnome.org/show_bug.cgi?id=711047
2013-11-11 22:38:36 +08:00
Chun-wei Fan
b27a2d436b gio/tests/gsubprocess.c: Fix on Windows
We need to check for the correct line endings on Windows (\r\n) for the
echo tests and currently need to skip the test_echo_eof test there, as
it depends on the cat utility that is not normally found on Windows, and
using an external installation of cat via MSYS or Cygwin would render the
test program to hang as cat waits for user input.

https://bugzilla.gnome.org/show_bug.cgi?id=711047
2013-11-11 22:38:05 +08:00
Chun-wei Fan
fd41363e02 tests/: Include unistd.h on *NIX only
https://bugzilla.gnome.org/show_bug.cgi?id=711047
2013-11-11 22:37:39 +08:00
Chun-wei Fan
5fd3c63ae8 glib/gspawn-win32-helper.c: Clean up a bit
Remove the parts about storing up the fd's in a data structure, but call
close() on the fd's.  However, retain the _get_osfhandle() check on the
fd's when we iterate through the fd's as on fd values in the iteration may
well be invalid fd's.  As a result, the invalid parameter handler is still
needed for newer Microsoft CRTs (8.0/2005+) for _get_osfhandle() to
make sure that the program does not abort when we check the validity of
fd's to be closed in the loop[1].

[1]: http://msdn.microsoft.com/en-us/library/ks2530z6%28v=vs.80%29.aspx
2013-11-11 22:37:10 +08:00
Chun-wei Fan
ccba409d34 tests/: Avoid closing invalid fd's
...and only include unistd.h when we are on *NIX.

Newer Visual C++ runtimes (8.0/2005 and later) will cause the program to
crash with an internal abort() call when they detect instances of close()
being called on an invalid fd, such as when the fd is -1, and these should
be purged anyways.

https://bugzilla.gnome.org/show_bug.cgi?id=711047
2013-11-11 22:36:32 +08:00
Chun-wei Fan
172aaa3a01 glib/gmessages.h: Unify log messages
...Under various compilers when !G_DISABLE_CHECKS.  Previously, the
messages that are logged differ depending whether GLib was built with GCC
or not.  To simplify test cases, make all builds use a single output format
for g_return_if_fail(), g_return_val_if_fail(), g_return_if_reached(), and
g_return_val_if_reached(), by using the GCC-style format and replaceing
__PRETTY_FUNCTION__ with G_STRFUNC, so that it will work across various
compilers.

https://bugzilla.gnome.org/show_bug.cgi?id=711047
2013-11-11 22:35:40 +08:00
Dan Winship
fff14a5b7c gcancellable: don't use g_cancellable_connect() in GCancellableSource
g_cancellable_connect() is documented as calling its callback only
once, but GCancellableSource should trigger every time the cancellable
is cancelled.

https://bugzilla.gnome.org/show_bug.cgi?id=710691
https://bugzilla.gnome.org/show_bug.cgi?id=711286
2013-11-11 09:28:07 -05:00
Shantha kumar
b4aee2a759 Updated Tamil Translations 2013-11-11 14:21:12 +05:30
Stef Walter
670379b26f gdbus-connection-loss: Fix leak in test
https://bugzilla.gnome.org/show_bug.cgi?id=711802
2013-11-11 08:46:45 +01:00
Stef Walter
14b27eaab8 gdbus-introspection: Fix leaks in tests
https://bugzilla.gnome.org/show_bug.cgi?id=711802
2013-11-11 08:46:33 +01:00
Stef Walter
e34d74bdb3 private: Use threading primitives correctly in private test
We shouldn't be clearing statically allocated mutexes, and also
don't use deprecated heap-allocated GPrivate.

https://bugzilla.gnome.org/show_bug.cgi?id=711755
2013-11-11 08:20:13 +01:00
Stef Walter
177fe9f98e timeloop: Fix leaks in tests
https://bugzilla.gnome.org/show_bug.cgi?id=711751
2013-11-11 08:14:45 +01:00
Stef Walter
9e0ade0691 file-test: Fix leaks in test
https://bugzilla.gnome.org/show_bug.cgi?id=711751
2013-11-11 08:10:51 +01:00
Stef Walter
dce83add18 gthreadpool: Don't pass bad data to GThreadPool sorter
This causes sorters to crash.

https://bugzilla.gnome.org/show_bug.cgi?id=711756
2013-11-11 07:57:52 +01:00
Stef Walter
81d0ebe29c gmain: Fix use of uninitialized memory in sigaction structure
https://bugzilla.gnome.org/show_bug.cgi?id=711754
2013-11-11 07:40:16 +01:00
Stef Walter
fd7b2faa64 defaultiface: Fix leak in test
https://bugzilla.gnome.org/show_bug.cgi?id=711779
2013-11-11 07:27:22 +01:00
Stef Walter
bac4179476 timeloop-closure: Fix leaks in test
https://bugzilla.gnome.org/show_bug.cgi?id=711779
2013-11-11 07:27:15 +01:00
Stef Walter
d8722441d1 signals: Fix leak in test
https://bugzilla.gnome.org/show_bug.cgi?id=711779
2013-11-11 07:27:01 +01:00