Commit Graph

21006 Commits

Author SHA1 Message Date
Philip Withnall
22b59c91ad tutorial: Stop referring to ->priv for example class
The class has used `G_DECLARE_FINAL_TYPE` for a while now, so doesn’t
have a `priv` struct. Private members are declared inline.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #1858
2019-08-29 09:19:03 +01:00
Philip Withnall
61912bffb5 tutorial: Improve type safety of property usage in GObject tutorial
This means that if you compile with `-Wswitch-enum`, the compiler will
warn you about properties which you’ve forgotten to handle in
`set_property()` or `get_property()`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #1858
2019-08-29 09:12:18 +01:00
Philip Withnall
fea016399c Merge branch 'fix_documentation' into 'master'
gsubprocesslauncher.c: fix documentation

See merge request GNOME/glib!1068
2019-08-29 07:18:40 +00:00
Sergio Costas
09e094a676 gsubprocesslauncher.c: fix documentation
The gobject introspection comments have a reference to an incorrect
class: they have, as 'self', the GSubprocess class instead of
GSubprocessLauncher.

This patch fixes this.
2019-08-29 00:15:03 +02:00
Philip Withnall
bae51732d1 Merge branch 'update-libffi-wrap-location' into 'master'
libffi.wrap: Meson port has moved to FDO gitlab

See merge request GNOME/glib!1066
2019-08-28 08:41:34 +00:00
Matthew Waters
6971528f65 gmacros: mark functions generated by autoptr macros as unused
clang will warn with -Wunused-function if the g_autoptr macros are
ever used inside a .c file.  This would break a lot of -Werror builds
with clang.

Mark such functions as explicitly unsed so clang will not warn about
them.
2019-08-28 18:08:29 +10:00
Matthew Waters
90f93a64f2 gtype: mark the inline functions in G_DECLARE_*_TYPE() as UNUSED
clang will warn about static inline functions where gcc will not.  Fixes
-Werror=unused-function with clang in dependant projects.
2019-08-28 18:08:29 +10:00
Nirbheek Chauhan
e0e4968dca Merge branch 'allow_NULL_argument_to_parse_strv' into 'master'
GOption: Allow NULL arguments to parse_strv

Closes #873

See merge request GNOME/glib!1064
2019-08-27 13:17:39 +00:00
Christian Persch
9d513beeca GOption: Allow NULL arguments to parse_strv
Close issue #873
2019-08-27 14:44:29 +02:00
Nirbheek Chauhan
a521fbddfe libffi.wrap: Meson port has moved to FDO gitlab 2019-08-27 18:13:11 +05:30
Philip Withnall
68b4dfd430 Merge branch 'gsettingsbackend-thread-safe-watches' into 'master'
GSettingsBackend - Fix thread-safety during destruction of GSettings instances...

Closes #1870

See merge request GNOME/glib!1040
2019-08-27 09:35:21 +00:00
Nirbheek Chauhan
7092b11bf4 Merge branch 'upate-win32-readme' into 'master'
Update win32 readme, add myself to codeowners

See merge request GNOME/glib!1059
2019-08-27 08:49:00 +00:00
Sebastian Dröge
d3ae4b1d30 GSettingsBackend - Fix thread-safety during destruction of GSettings instances while notifications are emitted
g_settings_backend_watch() uses a weak notify for keeping track of
the target. There's an explanation why this is supposed to be safe but
that explanation is wrong.

The following could happen before:

1. We have the target stored in the watch list
2. The last reference to the target is dropped in thread A and we end up
   in g_settings_backend_watch_weak_notify() right before the mutex
3. g_settings_backend_dispatch_signal() is called from another thread B
   and gets the mutex before 2.
4. g_weak_ref_init() is called on the target from thread B, which at
   this point has a reference count of exactly one (see g_object_unref()
   where it calls the weak notifies)
5. Thread A continues at 3. and drops the last reference and destroys
   the object. Now the GWeakRef from 4. points to a destroyed object. Note
   that GWeakRefs would be cleared before the weak notifies are called
6. At some later point another thread g_weak_ref_get() is called by
   g_settings_backend_invoke_closure() and accesses an already destroyed
   object with refcount 0 from the GWeakRef created in 4. by thread B (or
   worse, already freed memory that was reused).

Solve this by actually storing a GWeakRef of the target in the watch
list and only access the target behind it via the GWeakRef API, and then
pass a strong reference to the notification dispatch code.

The weak notify is only used to remove the (potentially with empty
GWeakRef) target from the list of watches and the only place that
compares the target by pointer instead of going through the GWeakRef
API.

Fixes https://gitlab.gnome.org/GNOME/glib/issues/1870
2019-08-27 11:09:08 +03:00
Nirbheek Chauhan
7952a74721 CODEOWNERS: Add myself as co-owner of Windows stuff
because I am a sucker for punishment.
2019-08-27 12:57:32 +05:30
Nirbheek Chauhan
184cbbcfd7 README.win32: Update and convert to markdown 2019-08-27 12:57:32 +05:30
Philip Withnall
1c41e348ae Merge branch '1819-file-for-uri-null' into 'master'
Resolve "Invalid characters in Open Location dialog crashes GIMP"

Closes #1819

See merge request GNOME/glib!966
2019-08-27 05:41:24 +00:00
Philip Withnall
562ac9de43 gwinhttpvfs: Fall back to wrapped VFS if creating a HTTP file fails
If we fail to create a GWinhttpFile for a URI (for example, because it’s
an invalid URI or is badly encoded), don’t just return NULL. Instead,
fall back to the wrapped VFS which might be able to handle it instead.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #1819
2019-08-27 08:21:26 +03:00
Philip Withnall
4b0421a730 gwinhttpfile: Document constructor as potentially returning NULL
It can return NULL if the URI was badly encoded or couldn’t be handled
by Windows’ API.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #1819
2019-08-27 08:21:26 +03:00
Philip Withnall
e24503a8e9 gvfs: Add an assertion to check that get_file_for_uri() is never NULL
It cannot return a NULL value, as none of its callers have error
handlng. Add an assertion to check the values returned by the VFS
implementations.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #1819
2019-08-27 08:21:25 +03:00
Philip Withnall
29388470f8 Merge branch 'easy-uwp-patches' into 'master'
Some (probably) easy uwp patches

See merge request GNOME/glib!1057
2019-08-26 20:18:45 +00:00
Nirbheek Chauhan
db3e0c256d glib: Don't call MessageBox() when building for UWP
However, it's fine to call it when building for the debug target
(which uses the debug CRT and hence sets -D_DEBUG), so let's keep that
around.

The Windows App Certification Kit only runs on apps built in release
mode.
2019-08-27 00:17:29 +05:30
Nirbheek Chauhan
2e2558b313 gmodule: Don't try to use toolhelp for symbol searching on UWP
This is not allowed under UWP.
2019-08-27 00:17:29 +05:30
Nirbheek Chauhan
f84ef02914 windows: Move G_WINAPI_ONLY_APP to config.h
Also set the Windows version to be 10 or newer when targeting UWP, since
the Windows 8 SDK does not have many of the APIs we need, such as
_beginthreadex.
2019-08-27 00:17:29 +05:30
Nirbheek Chauhan
5998851d09 Merge branch '1860-macros-available-in' into 'master'
glib: Mark various macros as available in certain versions of GLib

Closes #1860

See merge request GNOME/glib!1058
2019-08-26 18:36:33 +00:00
Philip Withnall
d196bfa4a4 glib: Mark various macros as available in certain versions of GLib
These macros wrap functions which were only introduced in certain
versions of GLib. The functions are correctly marked as introduced in
those versions, but the macros aren’t, which can result in not getting
appropriate deprecation warnings if you’re using those APIs when you
have said you’re targeting older GLib versions using
`GLIB_VERSION_MAX_ALLOWED`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #1860
2019-08-26 18:50:16 +03:00
Nirbheek Chauhan
fe01e81326 gutils: Remove dead code used for Windows SDK versions
We require a newer SDK version now, so this is not needed.
Specifically, we set _WIN32_WINNT to 0x0601, which sets our SDK
requirement to Windows 7+, and this code is only needed for MSVC 5.0,
which is ancient.
2019-08-26 19:46:59 +05:30
Emmanuele Bassi
9c34be6972 Merge branch 'error-docs' into 'master'
gerror: Add a docs paragraph about not displaying errors verbatim in UI

See merge request GNOME/glib!1054
2019-08-26 13:47:58 +00:00
Nirbheek Chauhan
4387f7b7b6 Merge branch '1803-gio-open-docs' into 'master'
docs: Mention environment variables in `gio open` documentation

Closes #1803

See merge request GNOME/glib!1051
2019-08-26 12:22:06 +00:00
Nirbheek Chauhan
1a0ba6410a Merge branch '1879-leak-suppressions' into 'master'
glib.supp: Add some missing suppressions for one-time allocations

Closes #1879

See merge request GNOME/glib!1052
2019-08-26 12:04:08 +00:00
Nirbheek Chauhan
23f405df80 Merge branch '1881-fix-gio-use-volume-monitor' into 'master'
gvolumemonitor: Use GIOModule methods for getting default type

Closes #1881

See merge request GNOME/glib!1056
2019-08-26 11:47:08 +00:00
Philip Withnall
fba54eaf59 gerror: Add a docs paragraph about not displaying errors verbatim in UI
It’s confusing and often doesn’t help the user. Match the error code and
come up with a more UI-appropriate error message.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-08-26 14:46:55 +03:00
Philip Withnall
0fba8f671c Merge branch 'meson-printf-cleanup' into 'master'
meson: small printf check cleanups

See merge request GNOME/glib!1032
2019-08-26 11:08:07 +00:00
Philip Withnall
0d54f00317 Merge branch 'gbacktrace_dup2_proper_handling' into 'master'
glib/gbacktrace.c: Handling properly the dup(stderr) call

Closes #1880

See merge request GNOME/glib!1055
2019-08-26 11:05:28 +00:00
Philip Withnall
833c24f45a gvolumemonitor: Use GIOModule methods for getting default type
This fixes use of `GIO_USE_VOLUME_MONITOR=help`, and simplifies the
code. The reason this wasn’t used already seems to just be because it
was missed when `_g_io_module_get_default_type()` was introduced in
2013. The previous `get_default_native_class()` code in
`gunionvolumemonitor.c` was introduced in 2007.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #1881
2019-08-26 13:41:26 +03:00
Charles Monzat
1d26d57e1a Update French translation 2019-08-26 09:21:54 +00:00
Zander Brown
4dfb747b3d Update British English translation 2019-08-26 09:08:11 +00:00
Emmanuel Fleury
1e3b1eb111 glib/gbacktrace.c: Handling properly the dup(stderr) call
If the dup(stderr) returns '-1' (an error occured), then the program
shouldn't call a 'close(stderr); dup(old_err);' after the exec() failed.

Fix issue #1880
2019-08-26 10:49:58 +02:00
Philip Withnall
c21892ee13 Merge branch 'optimize_g_nearest_pow' into 'master'
Optimize g_nearest_pow() function in glib/garray.c

Closes #83

See merge request GNOME/glib!1030
2019-08-26 06:21:53 +00:00
Jordi Mas
51c7baddd4 Update Catalan translation 2019-08-26 08:20:39 +02:00
Philip Withnall
12bd86a2ee Merge branch 'G_SIGNAL_RUN_CLEANUP_do_not_call_accumulate' into 'master'
Run the accumulator function for RUN_CLEANUP object handlers too

Closes #512

See merge request GNOME/glib!1053
2019-08-26 06:19:07 +00:00
Sebastian Dröge
153ac4c82a Run the accumulator function for RUN_CLEANUP object handlers too
Closes issue #512
2019-08-25 19:31:48 +02:00
Jeffrey Stedfast
2f8c61314c Optimize g_nearest_pow() function in glib/garray.c
Closes issue #83
2019-08-25 18:37:02 +02:00
Fran Dieguez
36a9b2f923 Update Galician translation 2019-08-25 16:22:45 +00:00
Philip Withnall
26934c6305 glib.supp: Add some missing suppressions for one-time allocations
Various memory allocations are still reachable when a process exits, as
they contain type system information which can’t be unloaded. Suppress
those using `glib.supp`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #1879
2019-08-25 14:35:27 +03:00
Philip Withnall
d4857047b3 Merge branch 'diagnostic-pragma-fix' into 'master'
tests: Fix a pragma warning on FreeBSD

See merge request GNOME/glib!1050
2019-08-25 09:07:48 +00:00
Philip Withnall
73b925ba6a Merge branch 'typos-doc' into 'master'
minor typos in the documentation

See merge request GNOME/glib!1049
2019-08-25 08:08:42 +00:00
Philip Withnall
b2eb0a6f15 docs: Mention environment variables in gio open documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #1803
2019-08-25 11:05:07 +03:00
Дилян Палаузов
512655aa12 minor typos in the documentation (a/an) 2019-08-24 19:14:05 +00:00
Philip Withnall
c178c9734c Merge branch 'static_analysis_2_40_patches' into 'master'
Static analysis 2 40 patches

Closes #905

See merge request GNOME/glib!1042
2019-08-24 14:22:38 +00:00
Colin Walters
651e3b05d8 glib/goption.c: Replace precondition with assertion
A static analysis run noted that we weren't freeing the cmdline in the
error path here.  We can just make this an assertion instead; I just
checked the kernel code, and it just usees a seq_printf() here which
will NUL terminate.
2019-08-24 15:55:49 +02:00