mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 03:25:13 +00: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
Notes:
github-actions[bot]
2024-12-26 16:24:16 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/4eda7b56468 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3046
1 changed files with 3 additions and 2 deletions
|
@ -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…
Add table
Reference in a new issue