glib/gobject/tests
Christian Hergert eb8a33625e gobject: Separate GWeakRef from GWeakNotify
This patch is based upon Garrett Regier's work from 2015 to provide
some reliability and predictability to how disposal handles weak
reference state.

A primary problem is that GWeakRef and GWeakNotify state is shared and
therefore you cannot rely on GWeakRef status due to a GWeakNotify
calling into second-degree code.

It's important to ensure that both weak pointer locations and GWeakRef
will do the proper thing before user callbacks are executed during
disposal. Otherwise, user callbacks cannot rely on the status of their
weak pointers. That would be mostly okay but becomes an issue when
second degree objects are then disposed before any notification of
dependent object disposal.

Consider objects A and B.

`A` contains a reference to `B` and `B` contains a `GWeakRef` to `A`.
When `A` is disposed, `B` may be disposed as a consequence but has not
yet been notified that `A` has been disposed. It's `GWeakRef` may also
cause liveness issues if `GWeakNotify` on `A` result in tertiary code
running which wants to interact with `B`.

This example is analagous to how `GtkTextView` and `GtkTextBuffer` work
in text editing applications.

To provide application and libraries the ability to handle this using
already existing API, `GWeakRef` is separated into it's own GData quark
so that weak locations and `GWeakRef` are cleared before user code is
executed as a consequence of `GData` cleanup.

# Conflicts:
#	gobject/tests/signals.c
2023-08-25 14:25:47 -07:00
..
performance tests: Don’t run the GObject performance tests under valgrind 2023-02-16 12:52:30 +00:00
accumulator.c tests: Add SPDX license headers automatically 2022-06-01 12:17:28 +01:00
autoptr.c Add a SPDX LicenseRef for the license historically used for tests 2022-11-02 12:34:19 +00:00
basic-signals.c tests: Add SPDX license headers automatically 2022-06-01 12:17:28 +01:00
basics-gobject.c tests: Fix a non-TAP formatted debug message in the basics-gobject test 2022-06-21 12:50:31 +01:00
binding.c Replace most GObject warnings with criticals 2022-08-09 13:18:47 -05:00
bindinggroup.c tests: Add SPDX license headers automatically 2022-06-01 12:17:28 +01:00
boxed.c Rename G_MARKUP_PARSE_FLAGS_NONE 2022-07-25 22:30:22 +01:00
closure-refcount.c Add a SPDX LicenseRef for the license historically used for tests 2022-11-02 12:34:19 +00:00
closure.c Fix the closure test in continuous 2014-05-30 10:22:35 -04:00
custom-dispatch.c custom-dispatch: Change SPDX-License-Identifier to match license grant 2022-11-02 12:35:45 +00:00
cxx.cpp Add SPDX license headers for LGPL-2.1-or-later to various files 2022-06-01 12:44:23 +01:00
defaultiface.c tests: Add SPDX license headers automatically 2022-06-01 12:17:28 +01:00
deftype.c tests: Add SPDX license headers automatically 2022-06-01 12:17:28 +01:00
deprecated-properties.c gobject: Add a test for deprecated properties 2022-09-21 10:27:55 +01:00
dynamictests.c Add a SPDX LicenseRef for the license historically used for tests 2022-11-02 12:34:19 +00:00
dynamictype.c gtype: Allow g_type_query() to be called on dynamic types 2023-07-30 11:25:42 +03:00
enums.c Use varargs for enum types definition macros 2022-06-30 01:46:54 +01:00
flags.c tests: Add SPDX license headers automatically 2022-06-01 12:17:28 +01:00
genmarshal.py Replace all uses of G_VA_COPY with Standard C va_copy 2022-10-26 18:07:55 +01:00
gobject-query.py tests: Fix code style in Python files to satisfy black and flake8 2022-10-19 12:28:08 +01:00
ifaceproperties.c tests: Add SPDX license headers automatically 2022-06-01 12:17:28 +01:00
marshalers.list Moving gobject tests from tests/gobjects to gobjects/tests 2022-05-26 19:13:19 +01:00
max-version.c tests: Test that we can include all headers with an old MAX_VERSION 2022-10-27 14:50:48 +01:00
meson.build gobject tests: Fix running custom-dispatch on 32-bit Windows 2023-06-30 11:32:54 +08:00
mkenums.py Take double-quote characters into account when parsing trigraph 2023-05-30 15:22:05 +02:00
notify-init2.c Add a SPDX LicenseRef for the license historically used for tests 2022-11-02 12:34:19 +00:00
notify-init.c Add a SPDX LicenseRef for the license historically used for tests 2022-11-02 12:34:19 +00:00
object.c testsuite: Make tests not fail in !debug builds 2022-05-28 08:02:16 -04:00
objects-refcount1.c gtype: avoid "-Wcast-align" warning with optimized G_TYPE_CHECK_INSTANCE_CAST() 2022-12-16 20:48:06 +01:00
objects-refcount2.c Moving tests/refcount/ directory to gobject/tests/ 2022-05-26 18:37:35 +01:00
override.c tests: Add SPDX license headers automatically 2022-06-01 12:17:28 +01:00
param.c gobject/tests/param: Add unit test for handling invalid NULL param spec 2022-10-10 21:01:10 +02:00
private.c glib: Avoid redefining GLIB_DISABLE_DEPRECATION_WARNINGS 2020-07-27 15:41:09 +01:00
properties-refcount1.c tests: Port GObject tests from g_thread_create() to g_thread_new() 2022-05-26 18:37:35 +01:00
properties-refcount2.c Moving tests/refcount/ directory to gobject/tests/ 2022-05-26 18:37:35 +01:00
properties-refcount3.c tests: Remove various bits of overly-verbose test output 2022-05-31 15:21:46 +01:00
properties-refcount4.c Moving tests/refcount/ directory to gobject/tests/ 2022-05-26 18:37:35 +01:00
properties.c gobject: Always ref-sink variants in g_object_set 2022-10-24 10:47:35 +01:00
qdata.c Add SPDX license headers for LGPL-2.1-or-later to various files 2022-06-01 12:44:23 +01:00
reference.c gobject: Do not call toggle down notifications if current refcount is not 1 2022-12-06 04:38:26 +01:00
references.c tests: Add SPDX license headers automatically 2022-06-01 12:17:28 +01:00
signal-handler.c tests: Allow signal-handler performance tests to be smoketested 2022-06-21 12:57:33 +01:00
signalgroup.c tests: Add SPDX license headers automatically 2022-06-01 12:17:28 +01:00
signals-refcount.c tests: Remove various bits of overly-verbose test output 2022-05-31 15:21:46 +01:00
signals.c gobject: Separate GWeakRef from GWeakNotify 2023-08-25 14:25:47 -07:00
singleton.c Merge branch 'more-spdx' into 'main' 2022-07-05 11:06:49 +00:00
taptestrunner.py tests: Add some SPDX license headers 2022-05-17 17:23:34 +01:00
testcommon.h tests: Add SPDX license headers automatically 2022-06-01 12:17:28 +01:00
testing.c Merge branch 'more-spdx' into 'main' 2022-07-05 11:06:49 +00:00
testmodule.c tests: Add SPDX license headers automatically 2022-06-01 12:17:28 +01:00
testmodule.h tests: Add SPDX license headers automatically 2022-06-01 12:17:28 +01:00
threadtests.c Add a SPDX LicenseRef for the license historically used for tests 2022-11-02 12:34:19 +00:00
type-flags.c tests: Add type flag tests for interfaces 2023-04-13 15:39:37 +01:00
type.c tests: Add some more tests for g_type_query() 2023-07-30 13:51:00 +03:00
value.c gobject: Avoid the ref/unref dance if assigning the same to a value 2022-12-20 17:48:21 +01:00