mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
LibCore: Make EventReceiver ref counting use atomics
This removes a race in ImageDecoder's make_decode_image_job(), where the ref count of `this` is mutated from separate threads in the callbacks.
This commit is contained in:
parent
3913e9f948
commit
4eda7b5646
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2021, Andreas Kling <andreas@ladybird.org>
|
||||
* Copyright (c) 2018-2024, Andreas Kling <andreas@ladybird.org>
|
||||
* Copyright (c) 2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/AtomicRefCounted.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/Forward.h>
|
||||
#include <AK/Function.h>
|
||||
|
|
@ -50,7 +51,7 @@ public: \
|
|||
}
|
||||
|
||||
class EventReceiver
|
||||
: public RefCounted<EventReceiver>
|
||||
: public AtomicRefCounted<EventReceiver>
|
||||
, public Weakable<EventReceiver> {
|
||||
// NOTE: No C_OBJECT macro for Core::EventReceiver itself.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user