History log of /haiku/headers/private/shared/WeakReferenceable.h
Revision Date Author Comments
# 776d091d 14-Mar-2024 Augustin Cavalier <waddlesplash@gmail.com>

WeakReferenceable: Return NULL in GetReference if the pointer is gone.

Fixes a major API footgun that caused #18759.


# 5d41cee8 31-Jan-2023 Augustin Cavalier <waddlesplash@gmail.com>

WeakReferenceable: Clear fUseCount when it is 1.

Otherwise, if there are remaining weak references, they could
potentially try to acquire the object and trigger a use-after-free.


# 1e860e07 31-Jan-2023 Augustin Cavalier <waddlesplash@gmail.com>

BPrivate::WeakReferenceable: Move implementation to a .cpp.

No functional change to the implementation, just getting it
out of a header.


# 077c84eb 05-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: atomic_*() functions rework

* No need for the atomically changed variables to be declared as
volatile.
* Drop support for atomically getting and setting unaligned data.
* Introduce atomic_get_and_set[64]() which works the same as
atomic_set[64]() used to. atomic_set[64]() does not return the
previous value anymore.


# b5c5640e 05-Jan-2012 czeidler <haiku@clemens-zeidler.de>

Style fixes. Thanks Axel and Ingo.


# 32951c4e 04-Jan-2012 czeidler <haiku@clemens-zeidler.de>

Make BReference and BWeakReference behave more like a normal pointer.
* Casts like BReference<Derived> to BReference<Base> are now possible.
* This cast for BWeakReference is, because of the underlying structure, not automatically type safe. I used a simple hack to make the compiler complain if the cast
is not type safe. Please take a look if that can be done better.
* Smaller style and bug fixes.


# ac805304 22-Sep-2011 Clemens Zeidler <clemens.zeidler@googlemail.com>

Use nothrow and add InitCheck method to check if allocation went fine.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42765 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cf53ed6f 22-Sep-2011 Clemens Zeidler <clemens.zeidler@googlemail.com>

New BWeakReferenceable API.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42763 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 756b64fd 16-Dec-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Removed the obsolescent [B]Reference[able] API and replaced the remaining
uses. Fixes the gcc 2 acpi build.
* Renamed WeakReferenceable::{Add,Remove}Reference() to
{Acquire,Release}Reference() for consistency.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39871 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8eb51285 24-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Made _GetUnchecked() return nothing, as it was ignored anyway.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30359 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 28a650e9 07-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Made the WeakReferenceable class templatized. Not really sure yet I like that
better, though :-)
* Also fixed a mixup of the unintuitive argument order of our
atomic_test_and_set(); I guess I will change that sooner or later.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29994 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e1fed132 06-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Added a WeakReferenceable implementation, completely untested yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29990 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 077c84eb27b25430428d356f3d13afabc0cc0d13 05-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: atomic_*() functions rework

* No need for the atomically changed variables to be declared as
volatile.
* Drop support for atomically getting and setting unaligned data.
* Introduce atomic_get_and_set[64]() which works the same as
atomic_set[64]() used to. atomic_set[64]() does not return the
previous value anymore.


# b5c5640ec03af45d19c7a0e0758c3c66d71c2095 05-Jan-2012 czeidler <haiku@clemens-zeidler.de>

Style fixes. Thanks Axel and Ingo.


# 32951c4e632ef88d5a2db417806eb5d0a0f4ec43 04-Jan-2012 czeidler <haiku@clemens-zeidler.de>

Make BReference and BWeakReference behave more like a normal pointer.
* Casts like BReference<Derived> to BReference<Base> are now possible.
* This cast for BWeakReference is, because of the underlying structure, not automatically type safe. I used a simple hack to make the compiler complain if the cast
is not type safe. Please take a look if that can be done better.
* Smaller style and bug fixes.


# ac805304953069173c75eaafcddf7546f63b0619 22-Sep-2011 Clemens Zeidler <clemens.zeidler@googlemail.com>

Use nothrow and add InitCheck method to check if allocation went fine.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42765 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cf53ed6f64b1480c034eb3dcaa24492ca2798b85 22-Sep-2011 Clemens Zeidler <clemens.zeidler@googlemail.com>

New BWeakReferenceable API.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42763 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 756b64fd836dad5b63f41f0b01f8cedfec795f9d 16-Dec-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Removed the obsolescent [B]Reference[able] API and replaced the remaining
uses. Fixes the gcc 2 acpi build.
* Renamed WeakReferenceable::{Add,Remove}Reference() to
{Acquire,Release}Reference() for consistency.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39871 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8eb51285d398bfebb34fc5b3f4f8d1ae41cf7bcd 24-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Made _GetUnchecked() return nothing, as it was ignored anyway.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30359 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 28a650e94d4a50a8fd84416cb4d37971cd81b6c2 07-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Made the WeakReferenceable class templatized. Not really sure yet I like that
better, though :-)
* Also fixed a mixup of the unintuitive argument order of our
atomic_test_and_set(); I guess I will change that sooner or later.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29994 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e1fed132d22ae23350588ad03bd63c2e4f68f061 06-Apr-2009 Axel Dörfler <axeld@pinc-software.de>

* Added a WeakReferenceable implementation, completely untested yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29990 a95241bf-73f2-0310-859d-f6bbb57e9c96