Commit Graph

13312 Commits

Author SHA1 Message Date
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
Matthias Clasen
a605b332c5 Dist assert-msg-test.gdb
And refer to it in srcdir. Otherwise, the test fails mysteriously
in make distcheck.
2013-01-14 23:48:33 -05:00
Ryan Lortie
5d42fdd068 visibility: Use a separate CFLAGS variable
We only want to control the default visibility for our five main
installable libraries: libglib, libgthread, libgmodule, libgobject,
libgio.  We should therefore only set -fvisibility=hidden when building
those.

Use a separate substitution variable for this purpose.

Using CFLAGS directly leads to some modules built in testcases not
exporting their symbols (and then the tests fail).  It also affects the
fam file monitoring module.

Colin had originally done it this way in his visibility patch series but
I failed to understand why so I didn't copy it.  Now I do.

Also: revert changes made to two testcases in an attempt to work around
this issue.

https://bugzilla.gnome.org/show_bug.cgi?id=691756
2013-01-14 23:31:59 -05:00
Matthias Clasen
7e00f38191 Fix module-test in a better way
Avoid having visibility attribute directly in the code by
adding a _GLIB_EXTERN-decorated declaration for the exported
variables.
2013-01-14 22:47:02 -05:00
Matthias Clasen
d4f0ae2c69 Fix distcheck
With gdbus-testserver now being a compiled program, it no longer
lives in SRCDIR.
2013-01-14 22:22:41 -05:00
Matthias Clasen
b96499690b Fix up visibility fallout in module-test 2013-01-14 21:31:47 -05:00
Matthias Clasen
d1c25d3191 Fix the assert-msg test
gdb is playing games with us, by breaking -x /dev/stdin
2013-01-14 17:35:47 -05:00
Matthias Clasen
ba4a3849c6 Remove an unused function 2013-01-14 16:14:28 -05:00
Matthias Clasen
57041baf58 Make the build more quiet 2013-01-14 16:14:28 -05:00
Ryan Lortie
456d6bb3e1 win32: hide g_win32_app_info_get_type()
This was in a private header file and was never part of the public ABI.
Hide it again.

Caught by Dieter Verfaillie.
2013-01-14 11:17:52 -05:00
Ryan Lortie
b7e749fc68 glocal*monitor: export ABI only on UNIX
Add an #ifdef G_OS_UNIX around the GLIB_AVAILABLE_IN_ALL annotation on
the _get_type() functions for GLocal{File,Directory}Monitor.

These symbols are in private header files and are only exported so that
the in-tree file monitoring modules can subclass.  This is only needed
on UNIX and was therefore never part of the public ABI on Windows.

Caught by Dieter Verfaillie.
2013-01-14 11:17:01 -05:00
Ryan Lortie
963243e6b5 win32: hide _glib_get_dll_directory again
This is not part of our public ABI and it's not used from the other
libraries in GLib, so we should not be exporting it.

Caught by Dieter Verfaillie.
2013-01-14 11:11:00 -05:00
Martin Pitt
aac8267233 GParamSpec: Make constructors introspectable
Commit 282366c326 unnecessarily (skip)ed all the GParamSpec constructors like
g_param_spec_bool(). Make those introspectable by dropping the (skip) and
adding proper transfer annotations.

Keep g_param_spec_value_array() skipped as GValueArray is deprecated.
2013-01-14 11:36:14 +01:00
Ryan Lortie
2c13657b0f tests: introduce a small hack for visibility
One of our testcases builds a small giomodule for testing the loading of
modules containing resources.  Unfortunately, this module gets built
using the same CFLAGS as the rest of GLib, including the visibility
flags (defaulting to hidden).

Use "config.h" to get a declaration of _GLIB_EXTERN that will export
symbols properly and use it to annotate the necessary APIs.
2013-01-14 00:13:00 -05:00
Ryan Lortie
f8756694cf gthread-impl.c: add missing #include "config.h"
One of the features of our new symbol exporting regime is that it forces
config.h to be included at the top of every .c file.

This was missed in gthread-impl.c.

The only reason this wasn't noticed is because nothing in this file is
being used anymore.  We need those symbols to continue to be exported
for reasons of ABI backwards compatibility, however.
2013-01-14 00:06:26 -05:00
Ryan Lortie
59e46c4928 kqueue: Reduce G_GNUC_INTERNAL + G_LOCK abuse
The kqueue file monitoring backend was misusing G_GNUC_INTERNAL for want
of 'static' in a couple of places and also using it to declare a lock
that was never used at all.

Fix those up.
2013-01-13 23:48:23 -05:00
Ryan Lortie
64e1a9ca50 gio: remove export tags from two private headers
I got a little bit too excited and added GLIB_AVAILABLE_IN_ALL tags to
some internal API.
2013-01-13 23:32:07 -05:00
Ryan Lortie
068a119f74 win32: build: stop using .def files
With visibility now under the control of __declspec(dllexport) we no
longer need to build .def files or use them for building our various
.dll files.

.def files used to be installed (even though it is only really useful
when creating the .dll or .lib file).  Don't do that anymore either.

The Makefiles still contain rules to create a .lib file for use with
Visual Studio and these rules require .def files.  There are special
requirements to using these rules (like having installed and setup
Microsoft tools for use during the build) and therefore the problem of
creating a .def file for use with them is left open to anyone willing to
make the effort.  Many options are available depending on which
toolchain is in use (dlltool, pexport, gendef, dumpbin.exe, just to name
a few).

If we can find a free tool for creating .lib files in the future, we
should probably revisit this issue and add proper support back to our
build system.
2013-01-13 22:59:40 -05:00
Ryan Lortie
2e7669f5cc configure.ac: change our visibility policy
Check for -fvisibility=hidden as a supported CFLAG.

If it is supported, use it and emit an AC_DEFINE to change the meaning
of _GLIB_EXTERN to include the GNU attribute for marking symbols as
public: __attribute((visibility("default"))).

This will override the public definition of _GLIB_EXTERN for any file
which does #include "config.h" (forcing all our .c files to do so, as a
side effect).

If we're on mingw, assume that -fvisibility will work and also throw in
a __declspec(dllexport) for good measure.  This will allow us to move
away from using a .def file to create the the various DLLs.

It's possible that there may be compilers that accept
-fvisibility=hidden but don't accept the GNU attribute for making
symbols public again -- we will hopefully receive bugs if any of those
exist.

https://bugzilla.gnome.org/show_bug.cgi?id=688681
2013-01-13 22:59:40 -05:00
Ryan Lortie
f13d3c075f win32: visibility fixups
Add/remove visibility macros according to if symbols were previously
part of our public win32 API.
2013-01-13 22:59:40 -05:00
Ryan Lortie
38359d1796 gio: hide another leaked symbol
guint g_menu_model_items_changed_signal leaked out.  Tuck it back in.
2013-01-13 22:59:40 -05:00
Rico Tzschichholz
47c9b1e315 gio: add some missing array annotations with their element-type 2013-01-13 20:49:15 +01:00
Rico Tzschichholz
85997d9eeb gio: add missing element-type annotation 2013-01-13 20:05:17 +01:00
Ryan Lortie
3bd09b5fa6 gmarshal.h: replace "extern" with GLIB_AVAILABLE_IN_ALL
This was one of the few public header files that was properly declaring
functions as "extern".  Switch it to use GLIB_AVAILABLE_IN_ALL instead.

https://bugzilla.gnome.org/show_bug.cgi?id=688681
2013-01-13 13:13:55 -05:00
Ryan Lortie
4625c138e9 gbacktrace.c: special treatment for a weird symbol
We have a public symbol 'glib_on_error_halt' that is exported from
gbacktrace.c without appearing in a header, presumably with the
intention that people will be able to hit it from their debugger.

Mark it as GLIB_AVAILABLE_IN_ALL from inside the .c file...

https://bugzilla.gnome.org/show_bug.cgi?id=688681
2013-01-13 13:13:43 -05:00
Ryan Lortie
b91c476827 Add a new _GLIB_EXTERN macro for "extern"
This macro simply evaluates the "extern" unless it has been explicitly
defined to something else.

All of the version macros (including the unversioned deprecation markers
and GLIB_AVAILABLE_IN_ALL) now include _GLIB_EXTERN as part of their
definition.

G_INLINE has also been modified to use _GLIB_EXTERN where appropriate.

This macro should never be used outside of the gmacros.h/gversonmacros.h
headers.

The effect of this patch is that "extern" has now been added to all
functions declared in installed headers.  Strictly speaking, this is
something we should have had all along...

GLIB_VAR and GOBJECT_VAR have also been modified to use _GLIB_EXTERN on
non-Windows, instead of "extern" which they were using before.  The
eventual goal is to use the normal version/deprecation macros on
exported variables and drop GLIB_VAR but we need to see how this will
work on Windows before we go ahead with that.

https://bugzilla.gnome.org/show_bug.cgi?id=688681
2013-01-13 13:13:36 -05:00
Ryan Lortie
ba1bdd0708 add a missing AVAILABLE_IN_2_36 annotation 2013-01-13 13:13:03 -05:00
Ryan Lortie
0156092a42 various: add GLIB_AVAILABLE_IN_ALL everywhere else
Add the GLIB_AVAILABLE_IN_ALL annotation to all old functions (that
haven't already been annotated with the GLIB_AVAILABLE_IN_* macros or a
deprecation macro).

If we discover in the future that we cannot use only one macro on
Windows, it will be an easy sed patch to fix that.

https://bugzilla.gnome.org/show_bug.cgi?id=688681
2013-01-13 13:11:57 -05:00
Ryan Lortie
0dba77d0f4 gioenumtypes.h.template: use GLIB_AVAILABLE_IN_ALL
glib-mkenums is not currently clever enough to know which version an
enum type was added in, so just mark all the _get_type() functions as
available in all versions.

https://bugzilla.gnome.org/show_bug.cgi?id=688681
2013-01-13 13:05:15 -05:00
Ryan Lortie
0a2b586259 gversionmacros.h: add GLIB_AVAILABLE_IN_ALL
Add a macro to declare that a particular symbol is available in all
versions of GLib.

All newly-added symbols should have proper version macros (like
GLIB_AVAILABLE_IN_2_36) and this macro is less likely to get used 'by
accident' for those than one with a name like GLIB_EXTERN or
GLIB_PUBLIC.

https://bugzilla.gnome.org/show_bug.cgi?id=688681
2013-01-13 13:05:09 -05:00
Henrique Dante de Almeida
c219181cb2 Add G_GNUC_PRINTF on all functions with format strings
This allows compilation with clang without errors, even when
-Wformat-nonliteral is active (as long as there are no real cases of
non literal formatting).

https://bugzilla.gnome.org/show_bug.cgi?id=691608
2013-01-13 12:32:40 -05:00