Commit Graph

16163 Commits

Author SHA1 Message Date
Roman Lebedev
4cda92b587 glib-compile-resources: do not leak c_name
As per #578363, "if one requests e.g. strings via GOptionEntry.arg_data
then those are strduped and needs to be free'ed by the application."

Fixes following leak:

=================================================================
==29426==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 10 byte(s) in 1 object(s) allocated from:
    0 0x7f3ab783d37a in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9437a)
    1 0x7f3ab70f7c82 in g_malloc /home/lebedevri/src/glib/glib/gmem.c:94
    2 0x7f3ab70f7f60 in g_malloc_n /home/lebedevri/src/glib/glib/gmem.c:330
    3 0x7f3ab713258e in g_strndup /home/lebedevri/src/glib/glib/gstrfuncs.c:425
    4 0x7f3ab709c86b in strdup_len /home/lebedevri/src/glib/glib/gconvert.c:864
    5 0x7f3ab709c966 in g_locale_to_utf8 /home/lebedevri/src/glib/glib/gconvert.c:905
    6 0x7f3ab7103c32 in parse_arg /home/lebedevri/src/glib/glib/goption.c:1276
    7 0x7f3ab71066fb in parse_long_option /home/lebedevri/src/glib/glib/goption.c:1670
    8 0x7f3ab7108047 in g_option_context_parse /home/lebedevri/src/glib/glib/goption.c:1997
    9 0x408532 in main /home/lebedevri/src/glib/gio/glib-compile-resources.c:629
    10 0x7f3ab6c72b44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b44)

https://bugzilla.gnome.org/show_bug.cgi?id=757299
2015-12-16 07:47:53 -05:00
Christian Hergert
3272267b99 macros: add G_GNUC_CHECK_VERSION() for compiler checks.
https://bugzilla.gnome.org/show_bug.cgi?id=728099
2015-12-16 07:47:53 -05:00
Allison Ryan Lortie
21b1c390a3 GApplication: destroy the impl on shutdown
It's theoretically possible (and see in the wild) for D-Bus messages to
come in to the application after shutdown() has been called and while
we're draining out the lingering events in the main context.

Prevent this from happening by ensuring we unregister our objects on
D-Bus during the shutdown process.

https://bugzilla.gnome.org/show_bug.cgi?id=757372
2015-12-16 07:47:53 -05:00
Ryan Lortie
aa16359986 Stop supporting non-POSIX getpwuid_r, getgrgid_r
Bug 13403 introduced support for the non-POSIX variants of these APIs
found on a system called "DG/UX".  Meanwhile, the complicated checks
here are breaking cross-builds on systems that we actually care about.

Remove the complicated checks and replace them with AC_CHECK_FUNCS.
Remove the resulting dead code from a couple of .c files.

https://bugzilla.gnome.org/show_bug.cgi?id=756475
2015-12-16 07:47:53 -05:00
Marius Gedminas
c935237e75 glib.py: Fix Python 3 TypeError in gdb pretty-printers
https://bugzilla.gnome.org/show_bug.cgi?id=749092
2015-12-15 19:40:43 -05:00
Paolo Borelli
c97729532f W32: fix uninitialized var in g_app_info_get_all_for_type
Compare with the handler->app, not with the app var which is not
initialized yet

https://bugzilla.gnome.org/show_bug.cgi?id=759408
2015-12-14 14:32:17 +01:00
Matthias Clasen
61136c2c73 Trivial doc comment fix
Use the same Since: syntax throughout.
2015-12-14 07:43:24 -05:00
Andrey Gursky
e9c9ff607c Add missing checks for gnulib vasnprintf()
Commit 212e4232e7 introduced a big update
of gnulib. Necessary changes to configure.ac from old gnulib commit
e8e63d1b31bca6c82713cba490b21a861abb24b5 have been forgotten. Actually
available functions are not discovered by autotools.

https://bugzilla.gnome.org/show_bug.cgi?id=759134
2015-12-07 20:52:10 -05:00
Sebastian Rasmussen
b3e0caa3e3 Updated Swedish translation 2015-12-02 21:12:12 +00:00
Chun-wei Fan
244f9e66f9 build/win32: Add NMake Makefile module for building tests and introspection
This adds a NMake Makefile module that can be used for building tests and
introspection using, NMake.  This is not yet distributed in the main GLib
tarballs, but this is placed here as the base location as this is
intended to be used in projects that support Visual Studio builds and
support the build of tests and/or introspection under Visual Studio using
NMake.
2015-12-02 21:23:10 +08:00
Chun-wei Fan
80dcec234c config.h.win32.in: Clean up a bit
Remove the HAVE_*INLINE items from here as well, since 'inline' is
unconditionally defined in gmacros.h.
2015-12-02 21:04:43 +08:00
Emmanuele Bassi
a81568273c docs: Be more precise on the use of set_resource_base_path()
The current wording is a bit vague on when to call
set_resource_base_path() in a GApplication implementation.
2015-12-01 12:57:02 +00:00
Chun-wei Fan
cfdd4cabe7 glib/glibconfig.h.win32.in: Clean up a bit further
Also get rid of the items regarding G_HAVE_*INLINE as they aren't used
anymore as they are removed from configure.ac.

Thanks to John Emmas and desrt for the earlier patch for getting
rid of the C4005 warnings.
2015-11-30 11:22:17 +08:00
Allison Ryan Lortie
f2fb877ef7 glibconfig.h.win32.in: remove G_CAN_INLINE
We now define this unconditionally in gmacros.h.

Thanks to John Emmas for the tip.

https://bugzilla.gnome.org/show_bug.cgi?id=757374
2015-11-27 11:31:41 -05:00
Allison Ryan Lortie
ec6971b864 gtypes.h: move G_STATIC_ASSERT to function scope
It seems that some compilers get upset if this is done at global scope,
so let's move it to function scope where we know it works.
2015-11-27 11:27:51 -05:00
Allison Ryan Lortie
a266ac62ea tests: fix a test on 32-bit builds
We were trying to squeeze 64-bit test vectors into gsize, which is fine
on 64bit systems but doesn't work very well on 32-bit.

Change that to a guint64.
2015-11-26 09:26:45 -05:00
Matthias Clasen
9787790448 GApplication: improve docs
Spell out which GVariant format strings to use for which
commandline option types. I just wasted some time debugging
this in an application.
2015-11-25 21:38:20 -05:00
Evangelos Foutras
db641e3292 GDBusProxy: Fix a memory leak during initialization
https://bugzilla.gnome.org/show_bug.cgi?id=758641
2015-11-25 17:33:11 -05:00
Allison Ryan Lortie
be225b76a7 GLib 2.47.3 2015-11-25 09:41:49 -05:00
Allison Ryan Lortie
ba12fbf8f8 gutils: g_bit_ inlines: add visibility macros
My careful efforts to preserve the exporting of these symbols on our ABI
was thwarted by our symbol visibility filtering.  Let's fix that.
2015-11-25 08:48:53 -05:00
Allison Ryan Lortie
4f18c671ab GLib 2.47.2 2015-11-24 19:44:46 +00:00
Allison Ryan Lortie
398c048c66 docs: remove GDBusObjectManager example
This example has been causing on-and-off build breaks for quite some
time.  In this case, the code for copying the generated content into the
main docs of GIO is causing problems with srcdir != destdir builds (due
to the files also being copied from the read-only srcdir during
distchecks).

We could probably work around this problem yet again, but since there is
no real benefit to having this content included, so let's remove it.

https://bugzilla.gnome.org/show_bug.cgi?id=734469
2015-11-24 18:44:02 +00:00
Tom Tryfonidis
69003a0751 Updated Greek translation
(cherry picked from commit bf0f0135a3)
2015-11-23 14:58:49 +00:00
Allison Ryan Lortie
7bc6f021d7 gmacros: fix unguarded use of __STDC_VERSION__
According to the C spec, any undefined identifier used in a #if
expression is taken to have a numerical value of zero.

Commit db2367e878 introduced an #i
statement which depended on this behaviour.

gcc has a -Wundef option which warns about depending on this behaviour,
and unfortunately there are projects that are using -Werror=undef in
builds that include our headers.

Adding a check for defined(__STDC_VERSION__) before using the macro is
enough to silence gcc.
2015-11-17 13:43:49 -05:00
Daniel Mustieles
1ee2db4a28 Updated Spanish translation 2015-11-17 18:48:06 +01:00
Dan Winship
f87e002313 Fix g_strerror() on non-glibc
When using one of the codepaths that copies the error string into buf,
make sure the string gets strdup() afterward.

https://bugzilla.gnome.org/show_bug.cgi?id=758194
2015-11-16 16:57:38 -05:00
GNOME Translation Robot
03cb2eb088 Added Scottish Gaelic translation 2015-11-16 18:20:41 +00:00
Allison Ryan Lortie
db2367e878 GLib: clean up the "inline" mess once and for all
It's been a long time since we've been unconditionally saying "static
inline" in GLib headers without complaints so it's safe to assume that
all compilers that we care about support this.

One thing that is not yet totally supported is the unadorned use of the
word "inline".  Depending on the flags (-std=c89, for example), even GCC
will complain about this.  Detect missing C99 support and define
"inline" to "__inline" in that case.  Some research shows "__inline"
appears to be the most widely-supported keyword here, but we may need to
tweak this if we get some reports of breakage.

Clean up all of the configure checks around this and define G_CAN_INLINE
unconditionally.  Unfortunately, we must assume that some people are
still using G_IMPLEMENT_INLINES, we must continue to implement that
(including undefining G_CAN_INLINE and redefining G_INLINE_FUNC) if
requested.

It is not our intent to break existing users of the old-style
G_INLINE_FUNC approach and if that has happened, we may need to make
some further adjustments.

https://bugzilla.gnome.org/show_bug.cgi?id=757374
2015-11-16 13:14:19 -05:00
Allison Ryan Lortie
9834f79279 gutils: clean up bit funcs inlining mess
gutils.h and gutils.c define three utility functions as inlines that are
also exported via the ABI.  This is done via complicated G_INLINE_FUNC
and G_IMPLEMENT_INLINES logic.

In order to be able to remove this mess, we create a another convoluted
but slightly cleaner approach: write straight-up inline versions of the
functions named _impl() in the header.  Define macros with the "public"
function names that call these inlines.  From the .c file, export the
ABI versions of these functions, implemented using the _impl() version.

https://bugzilla.gnome.org/show_bug.cgi?id=757374
2015-11-16 13:14:19 -05:00
Allison Ryan Lortie
0bfbb0d257 GTrashStack: uninline and deprecate
Deprecate GTrashStack and remove the inline implementations for the
functions.  This will help us clean up the mess that is inline functions
in GLib.

Because of how G_INLINE_FUNC worked, we have these functions on our ABI,
so we must continue to export them as normal functions.  We are safe to
remove the inline versions, however, because any existing binaries will
continue to carry them and any new builds will just start using the
non-inline versions.

https://bugzilla.gnome.org/show_bug.cgi?id=757374
2015-11-16 13:14:19 -05:00
Ben Iofel
7ab79b3879 GTask: fix example code in docs
https://bugzilla.gnome.org/show_bug.cgi?id=758181
2015-11-16 12:33:02 -05:00
Kjartan Maraas
448e01353a Updated Norwegian bokmål translation. 2015-11-15 23:59:35 +01:00
Chun-wei Fan
c50bb218de MSVC 2010+ builds: Do not explicitly use /LTCG
This partially reverts dc4361f.

As we now ensure that items using GResources and GConstructors are always
referenced so that the linker does not optimize them out in a default
Release build, we no longer need to enforce the use of /LTCG, so
/LTCG:incremental will work as well.
2015-11-12 15:26:20 +08:00
Chun-wei Fan
db4df9908e gconstructor: Work around constructors being optimized away on MSVC
Whole program optimization is enabled by default in visual studio
release builds, and this causes constructors (for e.g. resources) to be
optimized away as they are not referenced from elsewhere.

This works around this by some pragma magic.

https://bugzilla.gnome.org/show_bug.cgi?id=752837
2015-11-12 15:01:54 +08:00
Jeff Bai
228ad1ed9c Update zh_CN translations 2015-11-12 11:02:56 +08:00
Mikhail Zabaluev
0a10d38d15 Return value of g_hash_table_get_{keys,values} is (transfer container)
https://bugzilla.gnome.org/show_bug.cgi?id=757742
2015-11-07 18:55:17 +02:00
Mikhail Zabaluev
42463b840f ghash: Correctly annotate (nullable) and (out) parameters
https://bugzilla.gnome.org/show_bug.cgi?id=757742
2015-11-07 18:55:17 +02:00
Balázs Úr
0e53659971 Updated Hungarian translation 2015-11-07 15:08:05 +00:00
Philip Withnall
779b5c9af0 gtestutils: Fix a function name in a documentation example 2015-11-07 13:55:24 +01:00
Philip Withnall
25a7c817d3 glib: Add missing (nullable) and (optional) annotations
Add various (nullable) and (optional) annotations which were missing
from a variety of functions. Also port a couple of existing (allow-none)
annotations in the same files to use (nullable) and (optional) as
appropriate instead.

Secondly, add various (not nullable) annotations as needed by the new
default in gobject-introspection of marking gpointers as (nullable). See
https://bugzilla.gnome.org/show_bug.cgi?id=729660.

This includes adding some stub documentation comments for the
assertion macro error functions, which weren’t previously documented.
The new comments are purely to allow for annotations, and hence are
marked as (skip) to prevent the symbols appearing in the GIR file.

https://bugzilla.gnome.org/show_bug.cgi?id=719966
2015-11-07 10:48:32 +01:00
Sebastien Bacher
90808a0279 g_local_file_trash: remove invalid free call
Commit 8ece2de964 transplanted a block of
code that contained an early-exit-on-error case which freed several
variables.

Because of the move, the normal-path unconditional free of one of these
variables is now above this early exit case, so if this block is hit, it
will now be a double-free.

Remove that.

https://bugzilla.gnome.org/show_bug.cgi?id=757693
2015-11-06 11:55:57 -05:00
Philip Withnall
1ac2a606fc gtlsconnection: Fix a typo in the documentation 2015-11-06 11:27:24 +01:00
Dan Winship
751d3f00a8 Update .gitignore for overflow tests 2015-11-05 09:42:36 -05:00
Jan de Groot
4d74ca4c3a Make gtester-report compatible with Python 3
Convert tabs to spaces and replace print with print().
The script still works with Python 2.x.

https://bugzilla.gnome.org/show_bug.cgi?id=696324
2015-11-05 12:53:19 +01:00
Jussi Kukkonen
1c6e6671d1 gio/tests: Don't depend on a data file that's not built
data.gresource is not built when cross-compiling: Don't
add it to test_data in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=757628
2015-11-05 13:50:13 +02:00
Pedro Albuquerque
503e314748 Updated Portuguese translation 2015-11-05 05:58:56 +00:00
Simon McVittie
236e8040b4 Build gdbus-example-objectmanager-server again
It was removed, apparently accidentally, in commit 5b48dc4.
This had the side-effect that it wasn't included in tarball releases,
which means that commit ab7b4be doesn't work when building a package.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=734469
Reviewed-by: Colin Walters <walters@verbum.org>
2015-11-02 20:36:42 +00:00
Mikhail Zabaluev
0dbc81c73a Move G_POLLFD_FORMAT to glibconfig.h
It's a platform-specific macro, so it belongs in glibconfig.h.
This ensures that g-ir-scanner will not pick the wrong definition
for introspection.

https://bugzilla.gnome.org/show_bug.cgi?id=757294
2015-11-02 20:03:38 +02:00
Xavier Claessens
6f1b574cea Doc: Fix missing glibconfig.h when builddir!=srcdir
Currently the doc is incomplete when builddir!=srcdir
(e.g. debian package) because glibconfig.h is generared from
configure.ac and is thus missing from srcdir. This leads to
missing doc for symbols like G_GINT64_FORMAT.

https://bugzilla.gnome.org/show_bug.cgi?id=734469
2015-11-02 10:02:43 -05:00
Xavier Claessens
86a7c864b3 Doc: copy included example files
This fix missing files when src_dir != build_dir.

https://bugzilla.gnome.org/show_bug.cgi?id=734469
2015-11-02 09:26:58 -05:00