]> git.ipfire.org Git - thirdparty/vala.git/commit
codegen: Use GWeakRef for [SingleInstance] constructors
authorValeri Ochinski <v19930312@gmail.com>
Sun, 17 Dec 2023 15:33:18 +0000 (18:33 +0300)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 18 Dec 2023 19:36:40 +0000 (20:36 +0100)
commit0723d0fb91edc1298dcb79d9653e0276209197ae
treebe0e404857be3857768c6eea97fe5dfcf21ae930
parente4fe55735fb3e151dd6340b6d3fb8acca38193a4
codegen: Use GWeakRef for [SingleInstance] constructors

This prevents a potential race condition if object is destroyed at the same time
as it is created, since lock is not taken by the code removing a weak reference.

GWeakRef gives atomicity guarantees.
codegen/valagobjectmodule.vala
tests/objects/singleton.c-expected