mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
AK: Fix some WeakPtr copy constructor variants not copying the link
This commit is contained in:
parent
54eeb8ee9a
commit
34b3d92a13
Notes:
sideshowbarker
2024-07-19 00:19:56 +09:00
Author: https://github.com/tomuta Commit: https://github.com/SerenityOS/serenity/commit/34b3d92a13f Pull-request: https://github.com/SerenityOS/serenity/pull/4639 Issue: https://github.com/SerenityOS/serenity/issues/4621
2 changed files with 4 additions and 3 deletions
|
@ -91,7 +91,7 @@ public:
|
|||
{
|
||||
object.do_while_locked([&](U* obj) {
|
||||
if (obj)
|
||||
obj->template make_weak_ptr<U>().take_link();
|
||||
m_link = obj->template make_weak_ptr<U>().take_link();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ public:
|
|||
{
|
||||
object.do_while_locked([&](U* obj) {
|
||||
if (obj)
|
||||
obj->template make_weak_ptr<U>().take_link();
|
||||
m_link = obj->template make_weak_ptr<U>().take_link();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "Atomic.h"
|
||||
#include "RefCounted.h"
|
||||
#include "RefPtr.h"
|
||||
#include "StdLibExtras.h"
|
||||
#ifdef KERNEL
|
||||
# include <Kernel/Arch/i386/CPU.h>
|
||||
#endif
|
||||
|
@ -52,7 +53,7 @@ class WeakLink : public RefCounted<WeakLink> {
|
|||
friend class WeakPtr;
|
||||
|
||||
public:
|
||||
template<typename T, typename PtrTraits = RefPtrTraits<T>>
|
||||
template<typename T, typename PtrTraits = RefPtrTraits<T>, typename EnableIf<IsBaseOf<RefCountedBase, T>::value>::Type* = nullptr>
|
||||
RefPtr<T, PtrTraits> strong_ref() const
|
||||
{
|
||||
RefPtr<T, PtrTraits> ref;
|
||||
|
|
Loading…
Reference in a new issue