Commit Graph

29555 Commits

Author SHA1 Message Date
Philip Withnall
7262f5ab14 Merge branch '3234-libgirepository-refcount-cycle' into 'main'
gibaseinfo: Break refcount cycle with GIRepository

Closes #3234

See merge request GNOME/glib!3852
2024-01-25 22:52:17 +00:00
Philip Withnall
7eb69d279d gibaseinfo: Break refcount cycle with GIRepository
By shifting responsibility for ensuring that the lifetime of a
`GIRepository` always exceeds the lifetime of any of its `GIBaseInfo`s
to the user.

Keeping a weak ref from each `GIBaseInfo` to its `GIRepository` would be
too expensive (`GIBaseInfo`s are supposed to be cheap to create and
destroy, as they are used within function calls in language bindings).

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Fixes: #3234
2024-01-25 22:03:57 +00:00
Philip Withnall
01ef6bb49e Merge branch 'fix-post-merge-ci' into 'main'
ci: Fix post-merge CI pipelines

See merge request GNOME/glib!3851
2024-01-25 20:48:08 +00:00
Philip Withnall
c89b282623 ci: Fix post-merge CI pipelines
Don’t allow the `pages` job to be run (even manually) on post-merge
pipelines. It’s not particularly useful, and GitLab doesn’t like having
a manual job with unsatisfied dependencies in a pipeline:
```
'pages' job needs 'coverage' job, but 'coverage' is not in any previous stage
'pages' job needs 'style-check-advisory' job, but 'style-check-advisory' is not in any previous stage
```

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3847#note_1986044

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-25 20:31:34 +00:00
Philip Withnall
e04886aeb2 Merge branch 'optional-ci-runs' into 'main'
ci: Add ability to run manually some specific jobs

See merge request GNOME/glib!3847
2024-01-25 20:24:53 +00:00
Philip Withnall
7bb8a22494 Merge branch 'th/strdup-in-ascii-strdown' into 'main'
[th/strdup-in-ascii-strdown] glib: use g_strdup() in g_ascii_strdown(),g_ascii_strup()

See merge request GNOME/glib!3850
2024-01-25 20:19:25 +00:00
Thomas Haller
6955c25e85 glib: use g_strdup() in g_ascii_strdown(),g_ascii_strup()
g_strndup() internally uses strncpy(), while g_strdup() uses memcpy().
Most likely, memcpy() is faster.

Instead of strlen()+g_strndup(), use  g_strdup() as we don't need the
length.
2024-01-25 20:11:48 +01:00
Marco Trevisan (Treviño)
99c8f7fafc ci: Run docs and coverity builds only on schedules in default branch
Also allow running them manually if required, but this still needs to be
done from a GNOME/glib:main pipeline.
2024-01-25 17:56:36 +01:00
Marco Trevisan (Treviño)
11616b0145 ci: Allow to run jobs that only run in origin repos manually 2024-01-25 17:56:36 +01:00
Marco Trevisan (Treviño)
2a532e19cd ci: Add ability to run manually some specific jobs
In some merge requests there are bits (such as memory leaks) that we may want
to test before merging and that the schedules will run them.

As per this add a rule to make them manual, and apply it to some jobs.
2024-01-25 17:46:59 +01:00
Philip Withnall
96b1298871 Merge branch 'improve-documentation' into 'main'
gprintf/gstrfuncs: Improve and port doc comments to gi-docgen

See merge request GNOME/glib!3807
2024-01-25 12:16:57 +00:00
velsinki
66cd331172 gstrfuncs: Improve and port doc comments to gi-docgen
This fixes many things from the port to gi-docgen, but also improves
documentation more generally.

Main improvements/fixes:
- Fix links to functions, constants, etc.
- Rewrite code syntax to work with Markdown
- Reduce indentation (do not indent by 4 to prevent code blocks)
- Remove redundant text such as "can be NULL" or "should be freed"
- Move text from large return info texts to main function text
- Remove periods at the end of parameter and return descriptions
- Do not capitalize the first word of a parameter or return description
- Try to improve consistency between docs for similar functions
- Convert %TRUE and %FALSE into true and false
- Convert other uses of `%` and `#` into inline code

Helps: #3037
2024-01-25 11:35:48 +00:00
velsinki
a834b8b038 gstrfuncs: Add missing (array) annotations to GStrv comparison functions 2024-01-25 11:35:12 +00:00
velsinki
dc7331f4fb gstrfuncs: Add missing (optional) annotation to g_str_tokenize_and_fold() 2024-01-25 11:33:09 +00:00
velsinki
2d5955c4f3 gstrfuncs: Add missing (array) annotation to g_strv_length() 2024-01-25 11:32:56 +00:00
velsinki
b869908f16 gstrfuncs: Add missing (array) annotations to g_strdupv() and g_strjoinv() 2024-01-25 11:29:52 +00:00
velsinki
8689a1f8b7 gstrfuncs: Add missing (nullable) annotations to g_strndup() 2024-01-25 11:25:09 +00:00
velsinki
2d5f608454 gstrfuncs: Add missing (transfer) and (nullable) annotations to g_memdup() 2024-01-25 11:22:54 +00:00
velsinki
16ea531ecb gstrfuncs: Add missing (array) annotation to g_strfreev() 2024-01-25 11:20:00 +00:00
velsinki
8d2d12bd52 gprintf: Port doc comments to gi-docgen
Fixes broken links, and removes `%` and `#` notation in favor of inline
code, and limits indentation to two to prevent accidental formatting.

Fixes some style issues too, mainly removing periods at the end of
parameter and return descriptions.

Also removes trailing whitespace from the doc comments.

Helps: #3037
2024-01-25 11:19:23 +00:00
velsinki
2b22befc4f gprintf: Add missing (out) annotation to g_vasprintf() 2024-01-25 11:19:23 +00:00
Philip Withnall
c92c1502d2 Merge branch 'remove-deprecated-girepository-flags' into 'main'
girepository: Remove GI_FUNCTION_THROWS and GI_VFUNC_THROWS flags

See merge request GNOME/glib!3849
2024-01-25 11:02:28 +00:00
Philip Chimento
ad9cd1762a girepository: Remove GI_FUNCTION_THROWS and GI_VFUNC_THROWS flags
These flags were replaced by gi_callable_info_can_throw_error() in
girepository 1.x, but the flags were maintained for backwards
compatibility. No need to hold on to them in the 2.x API.

Note that these flags are also still maintained as separate bits in the
binary format, which is not changing. So, they still need to be read
from FunctionBlob and VFuncBlob if the bit is not set in SignatureBlob.

This is an API break for girepository 2.x, which is OK because the API
has never been released yet.
2024-01-24 20:45:28 -08:00
Marco Trevisan
856850ab15 Merge branch 'fix-introspection-build-windows' into 'main'
Fix build with introspection on Windows

See merge request GNOME/glib!3848
2024-01-24 18:20:04 +00:00
Luca Bacci
f7c4825d91 Fix build with introspection on Windows 2024-01-24 18:16:58 +01:00
Philip Withnall
b3abf56ced Merge branch 'girepository-tests' into 'main'
Add more test coverage for girepository

See merge request GNOME/glib!3843
2024-01-24 08:41:23 +00:00
Philip Chimento
cda9ebeb03 tests: Port over some GIRepository tests from g-i 1.x
These tests come from gobject-introspection/tests/repository/. They
include whatever wasn't already covered by the existing tests.

The original files didn't have copyright information. That's been
reconstructed from commit messages of commits that added a test or a
substantial part of one.
2024-01-23 22:04:52 -08:00
Philip Chimento
3c984faf23 tests: Use runtime casts
Using casts like GI_OBJECT_INFO() that log a critical when the
introspection info is of the wrong type, will help to locate bugs.
2024-01-23 22:04:52 -08:00
Philip Chimento
b8a65edb01 tests: Use fixture in GIRepository tests
This deduplicates some code and will allow writing further tests more
easily.
2024-01-23 22:04:52 -08:00
Philip Chimento
d41f05e9cf build: Add libffi dependency to girepository/function-info test
I found that this dependency is needed for girffi.h to find ffi.h.
2024-01-23 21:59:38 -08:00
Philip Chimento
28835733a2 tests: Fix defaultvalue test on macOS
Without these includes, the g_osx_app_info_get_type() in
giotypefuncs.inc is missing a declaration.
2024-01-23 21:35:54 -08:00
Philip Withnall
01e197868d Merge branch '3218-girepository-stack-allocations' into 'main'
gibaseinfo: Fix use of stack-allocated GIBaseInfos

Closes #3218

See merge request GNOME/glib!3846
2024-01-23 23:08:41 +00:00
Philip Withnall
9b5d008f60 girffi: Rename gi_function_invoker_destroy() to …_clear()
This brings its naming more in line with modern GLib conventions.

This is an API break, but libgirepository is not API frozen yet.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-23 22:55:35 +00:00
Philip Withnall
3e157c688e girffi: Add a test for gi_function_info_prep_invoker()
This test case was originally written by Philip Chimento as a reproducer
for #3218. Let’s add it to the test suite to catch regressions in
stack-allocated `GIBaseInfo` handling.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3218
2024-01-23 18:10:03 +00:00
Philip Withnall
998baf9afb girffi: Expand docs for gi_function_info_prep_invoker()
Mention that the returned `GIFunctionInvoker` needs to be cleared.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-23 18:09:28 +00:00
Philip Withnall
bf4cf2d464 gibaseinfo: Fix use of stack-allocated GIBaseInfos
Most of the code for handling stack-allocated infos was correct, it was
just missing code to initialise the `GTypeInstance` member.

Since `GTypeInstance` isn’t really designed for stack allocation, this
is a little hacky — it requires setting up the member within
`GTypeInstance` manually. It works, though.

The externally visible consequence of this, though, is that
stack-allocated `GIBaseInfo`s now need to be cleared when they’re
finished being used. This allows the `GTypeClass` ref to be dropped.

All users of the stack-allocated APIs in libgirepository will need to
adapt to this change.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Fixes: #3218
2024-01-23 18:07:17 +00:00
Philip Withnall
eb94acce21 gibaseinfo: Make gi_info_init() take a GType rather than a GIInfoType
This is one more step towards removing `GIInfoType`, and will also help
in a following commit which will directly make use of the `GType`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3218
2024-01-23 18:06:08 +00:00
Philip Withnall
c8c1febc7d gibaseinfo: Fix a double-unref with stack-allocated GIBaseInfos
As documented in the commit, the internal members of `GIBaseInfo` are
not reffed if the `GIBaseInfo` is stack-allocated, as the caller can be
relied on to ensure their lifetime exceeds that of the `GIBaseInfo`.

Make sure that’s actually reflected in the code.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3218
2024-01-23 17:55:26 +00:00
Philip Withnall
a3da3a032c gibaseinfo: Change argument type for gi_type_info_init()
Make it take a `GITypeInfo` rather than a `GIBaseInfo`, because that’s
what it actually operates on.

This is an internal API, so this isn’t an API break.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3218
2024-01-23 17:53:15 +00:00
Philip Withnall
fee9223e74 Merge branch '2887-memory-monitor-tests' into 'main'
tests: Fix race condition in memory-monitor-dbus.test

Closes #2887

See merge request GNOME/glib!3844
2024-01-23 11:16:52 +00:00
Philip Withnall
67a9fbf1fa tests: Wait for memory monitor to be able to handle signals before testing
This fixes a race condition which frequently caused the
`memory-monitor-dbus.py` test to fail.

The registration of the `LowMemoryMonitor` object on the bus, and the
`GMemoryMonitorDBus`’s connection to the warning signal raced, such that
it was possible for the mock `LowMemoryMonitor` to emit a warning signal
before the `GMemoryMonitorDBus` proxy was listening, and hence the proxy
would never see the signal.

Fix this by explicitly synchronising the two before proceeding to the
tests.

Make the same changes in the `memory-monitor-portal.py` test too, even
though that one was not failing. This should remove the need for a 2s
wait on every test run.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Fixes: #2887
2024-01-23 11:02:48 +00:00
Philip Withnall
e0276a3a17 tests: Wait for LMM server to be available when starting test
Otherwise the test can go on to wait for a signal from the service
before it’s actually finished starting up.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #2887
2024-01-23 11:02:48 +00:00
Philip Withnall
1f2d9e69c9 tests: Assert correct monitor implementation is used in power-profile-monitor-dbus
This wasn’t failing, but it seems like a sensible thing to check.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #2887
2024-01-23 11:02:48 +00:00
Philip Withnall
6b22aaaa68 tests: Assert correct monitor implementation is used in memory-monitor-dbus
This wasn’t failing, but it seems like a sensible thing to check.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #2887
2024-01-23 11:02:48 +00:00
Philip Withnall
e3b81b3f0d tests: Rework assertEventually() to use GLib main context
Rather than sleeping and blocking everything, use a timeout source on
the main context so that inputs can continue to be handled while waiting
for a timeout.

This introduces no functional changes to the test.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #2887
2024-01-23 11:02:48 +00:00
Philip Withnall
b8fba4ddb4 Merge branch 'freebsd-iconv' into 'main'
gconvert: match GNU iconv behaviour on FreeBSD

See merge request GNOME/glib!3824
2024-01-22 18:40:03 +00:00
Ting-Wei Lan
ec780d0d4a Use the FreeBSD cgit URL 2024-01-22 15:39:33 +00:00
Philip Withnall
143cb92c35
2.79.1
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-22 14:30:24 +00:00
Philip Withnall
8a4ad5f998 tests: Add some debug output to memory-monitor-dbus.py test
This will hopefully help diagnose #2887.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #2887
2024-01-22 11:22:45 +00:00
Philip Withnall
5278efbd63 tests: Ensure Python assertEventually() function uses correct main context
It should be doing already (or the tests would never work), but make it
clearer in the code that the same `GMainContext` is being iterated as is
being woken up in the rest of the test.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #2887
2024-01-22 11:22:01 +00:00