<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/glib.git/gobject/gobject.c, branch pgriffis/wip/resolver-https</title>
<subtitle>gitlab.gnome.org: GNOME/glib.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/glib.git/'/>
<entry>
<title>Defer GObject::notify during object destruction</title>
<updated>2021-11-29T15:43:59+00:00</updated>
<author>
<name>Emmanuele Bassi</name>
<email>ebassi@gnome.org</email>
</author>
<published>2021-11-28T00:36:06+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/glib.git/commit/?id=1ec331266ac5782223d3dafa6c9176eaeefcebae'/>
<id>1ec331266ac5782223d3dafa6c9176eaeefcebae</id>
<content type='text'>
Notifying during object destruction is a dubious "feature": objects
might end up recreating a bunch of state just before clearing it;
language bindings might get spurious notifications during garbage
collection runs.

We freeze the notification queue before running the dispose() chain; if
the object was temporarily vivified during dispose, we thaw the
notification queue, otherwise we let the instance clear it when we
finalize it.

See: https://gitlab.gnome.org/GNOME/gjs/-/issues/445
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Notifying during object destruction is a dubious "feature": objects
might end up recreating a bunch of state just before clearing it;
language bindings might get spurious notifications during garbage
collection runs.

We freeze the notification queue before running the dispose() chain; if
the object was temporarily vivified during dispose, we thaw the
notification queue, otherwise we let the instance clear it when we
finalize it.

See: https://gitlab.gnome.org/GNOME/gjs/-/issues/445
</pre>
</div>
</content>
</entry>
<entry>
<title>gobject: Use new g_newa0() function</title>
<updated>2021-11-26T12:24:23+00:00</updated>
<author>
<name>Nishal Kulkarni</name>
<email>nishalkulkarni@gmail.com</email>
</author>
<published>2021-11-25T10:48:00+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/glib.git/commit/?id=1529c2ca4d44d0bb82f5ea416d77dc776e90510d'/>
<id>1529c2ca4d44d0bb82f5ea416d77dc776e90510d</id>
<content type='text'>
Replace old `g_newa()` and `memset()` with `g_newa0()`
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Replace old `g_newa()` and `memset()` with `g_newa0()`
</pre>
</div>
</content>
</entry>
<entry>
<title>gobject: Add advice on larger alignment requirements for GObject members</title>
<updated>2021-11-17T11:56:20+00:00</updated>
<author>
<name>Philip Withnall</name>
<email>withnall@endlessm.com</email>
</author>
<published>2017-12-08T14:57:28+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/glib.git/commit/?id=7a8756d247a5c54be121668919ae9cac2f8ae4fb'/>
<id>7a8756d247a5c54be121668919ae9cac2f8ae4fb</id>
<content type='text'>
We now guarantee that GObjects will always be allocated at least as
aligned as the basic types. If you want to put an element in your
GObject which has higher alignment requirements, we can’t guarantee it
will be aligned*. If you need it to be aligned, you’ll need to put it on
the heap (aligned appropriately), or add appropriate padding in your
GObject struct.

*Actually, GSlice will guarantee that the whole GObject is aligned to at
least the power of 2 greater than or equal to the size of the GObject,
which means any element in the GObject struct should always be
appropriate aligned if the compiler pads it appropriately. If malloc()
is used, however, it doesn’t make that guarantee, so we can’t make that
guarantee overall.

Signed-off-by: Philip Withnall &lt;withnall@endlessm.com&gt;

Helps: #1231
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We now guarantee that GObjects will always be allocated at least as
aligned as the basic types. If you want to put an element in your
GObject which has higher alignment requirements, we can’t guarantee it
will be aligned*. If you need it to be aligned, you’ll need to put it on
the heap (aligned appropriately), or add appropriate padding in your
GObject struct.

*Actually, GSlice will guarantee that the whole GObject is aligned to at
least the power of 2 greater than or equal to the size of the GObject,
which means any element in the GObject struct should always be
appropriate aligned if the compiler pads it appropriately. If malloc()
is used, however, it doesn’t make that guarantee, so we can’t make that
guarantee overall.

Signed-off-by: Philip Withnall &lt;withnall@endlessm.com&gt;

Helps: #1231
</pre>
</div>
</content>
</entry>
<entry>
<title>gobject: Assert that GObjects are at least as aligned as basic types</title>
<updated>2021-11-17T11:56:20+00:00</updated>
<author>
<name>Philip Withnall</name>
<email>withnall@endlessm.com</email>
</author>
<published>2017-12-08T14:34:34+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/glib.git/commit/?id=0749643daaa818e78d68da27db5378f15eb31e0b'/>
<id>0749643daaa818e78d68da27db5378f15eb31e0b</id>
<content type='text'>
See the reasoning in the patch for why we believe GObjects *are*
(already) as aligned as the basic types.

We want to make this guarantee so that it’s guaranteed to be safe for
people to ignore -Wcast-align warnings for GObjects which contain basic
types. This typically happens with gdouble on 32-bit ARM platforms.

The checks are slightly complicated by the need to support GObjects with
custom constructors. We should expect that a custom construction
function will chain up to g_object_constructor (which calls
g_type_create_instance() as normal), but it’s possible that someone has
done something crazy and uses a custom allocator which doesn’t return
with the same alignment as GSlice. Hand them a warning in that case. If
that is true, the code which uses their custom-constructed GObject can
presumably already deal with the alignment it gets given.

Signed-off-by: Philip Withnall &lt;withnall@endlessm.com&gt;

Helps: #1231
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
See the reasoning in the patch for why we believe GObjects *are*
(already) as aligned as the basic types.

We want to make this guarantee so that it’s guaranteed to be safe for
people to ignore -Wcast-align warnings for GObjects which contain basic
types. This typically happens with gdouble on 32-bit ARM platforms.

The checks are slightly complicated by the need to support GObjects with
custom constructors. We should expect that a custom construction
function will chain up to g_object_constructor (which calls
g_type_create_instance() as normal), but it’s possible that someone has
done something crazy and uses a custom allocator which doesn’t return
with the same alignment as GSlice. Hand them a warning in that case. If
that is true, the code which uses their custom-constructed GObject can
presumably already deal with the alignment it gets given.

Signed-off-by: Philip Withnall &lt;withnall@endlessm.com&gt;

Helps: #1231
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'weak-refs-docs' into 'main'</title>
<updated>2021-10-27T23:37:22+00:00</updated>
<author>
<name>Michael Catanzaro</name>
<email>mcatanzaro@gnome.org</email>
</author>
<published>2021-10-27T23:37:22+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/glib.git/commit/?id=98e0789fea615be6b2baa648a891b607eb7016db'/>
<id>98e0789fea615be6b2baa648a891b607eb7016db</id>
<content type='text'>
gobject: Clarify behaviour of adding weak refs during disposal

See merge request GNOME/glib!2255</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
gobject: Clarify behaviour of adding weak refs during disposal

See merge request GNOME/glib!2255</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'ebassi/floating-warning' into 'main'</title>
<updated>2021-09-21T11:09:16+00:00</updated>
<author>
<name>Philip Withnall</name>
<email>philip@tecnocode.co.uk</email>
</author>
<published>2021-09-21T11:09:16+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/glib.git/commit/?id=579ff9f6c9aa0b84df2d14634523601297807d7d'/>
<id>579ff9f6c9aa0b84df2d14634523601297807d7d</id>
<content type='text'>
Add a (diagnostic) warning for finalized floating objects

Closes #2489

See merge request GNOME/glib!2247</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add a (diagnostic) warning for finalized floating objects

Closes #2489

See merge request GNOME/glib!2247</pre>
</div>
</content>
</entry>
<entry>
<title>gobject: Ensure an object has toggle references before notifying it</title>
<updated>2021-09-20T15:56:25+00:00</updated>
<author>
<name>Marco Trevisan (Treviño)</name>
<email>mail@3v1n0.net</email>
</author>
<published>2021-04-28T19:54:45+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/glib.git/commit/?id=468246bb3b83539bcb83397a7cec6d767573bfb2'/>
<id>468246bb3b83539bcb83397a7cec6d767573bfb2</id>
<content type='text'>
When an object with toggle reference is notifying a change we just
assume that this is true because of previous checks.
However, while locking, another thread may have removed the toggle
reference causing the waiting thread to abort (as no handler is set at
that point).

To avoid this, once we've got the toggle references mutex lock, check
again if the object has toggle reference, and if it's not the case
anymore just ignore the request.

Add a test that triggers this, it's not 100% happening because this is
of course timing related, but this is very close to the truth.

Fixes: #2394
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When an object with toggle reference is notifying a change we just
assume that this is true because of previous checks.
However, while locking, another thread may have removed the toggle
reference causing the waiting thread to abort (as no handler is set at
that point).

To avoid this, once we've got the toggle references mutex lock, check
again if the object has toggle reference, and if it's not the case
anymore just ignore the request.

Add a test that triggers this, it's not 100% happening because this is
of course timing related, but this is very close to the truth.

Fixes: #2394
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'prop-set-speedups' into 'main'</title>
<updated>2021-09-20T12:47:00+00:00</updated>
<author>
<name>Philip Withnall</name>
<email>philip@tecnocode.co.uk</email>
</author>
<published>2021-09-20T12:47:00+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/glib.git/commit/?id=3f1a1cdb7811dedc7a5fac87ebacbec877e9c04f'/>
<id>3f1a1cdb7811dedc7a5fac87ebacbec877e9c04f</id>
<content type='text'>
Small optimization for g_object_set

See merge request GNOME/glib!2254</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Small optimization for g_object_set

See merge request GNOME/glib!2254</pre>
</div>
</content>
</entry>
<entry>
<title>gobject: Clarify behaviour of adding weak refs during disposal</title>
<updated>2021-09-20T12:23:34+00:00</updated>
<author>
<name>Philip Withnall</name>
<email>pwithnall@endlessos.org</email>
</author>
<published>2021-09-20T12:18:03+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/glib.git/commit/?id=3b67d5322771544977d0f7c03ce7ad91af946874'/>
<id>3b67d5322771544977d0f7c03ce7ad91af946874</id>
<content type='text'>
The previous wording was not clear about what happens if a new weak ref
is taken during disposal (shortly after resurrecting the object with a
new strong ref, otherwise taking the weak ref is invalid).

See: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2064/diffs#note_1270092

Signed-off-by: Philip Withnall &lt;pwithnall@endlessos.org&gt;

Helps: #2390
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The previous wording was not clear about what happens if a new weak ref
is taken during disposal (shortly after resurrecting the object with a
new strong ref, otherwise taking the weak ref is invalid).

See: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2064/diffs#note_1270092

Signed-off-by: Philip Withnall &lt;pwithnall@endlessos.org&gt;

Helps: #2390
</pre>
</div>
</content>
</entry>
<entry>
<title>Small optimization for g_object_setv</title>
<updated>2021-09-20T12:21:49+00:00</updated>
<author>
<name>Matthias Clasen</name>
<email>mclasen@redhat.com</email>
</author>
<published>2021-09-20T12:20:04+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/glib.git/commit/?id=497986cdc1fe9e7f719ca8982b2f7c7942f081c6'/>
<id>497986cdc1fe9e7f719ca8982b2f7c7942f081c6</id>
<content type='text'>
No need to call memset in the loop, we can just
initialize all the values in one go.

GtkBuilder is now using g_object_setv, so this
may improve application start times a bit.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
No need to call memset in the loop, we can just
initialize all the values in one go.

GtkBuilder is now using g_object_setv, so this
may improve application start times a bit.
</pre>
</div>
</content>
</entry>
</feed>
