1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 09:34:57 +09:00

LibGfx: Make Bitmap atomic ref-counted

Fixes race condition when rendering thread runs destructor for
Gfx::Bitmap owned by PaintingSurface, which was not thread-safe.
This commit is contained in:
Aliaksandr Kalenik 2025-04-23 16:40:44 +02:00 committed by Alexander Kalenik
parent 234c07adc9
commit 8f20899533
Notes: github-actions[bot] 2025-04-24 01:13:17 +00:00

View file

@ -7,8 +7,8 @@
#pragma once
#include <AK/AtomicRefCounted.h>
#include <AK/Function.h>
#include <AK/RefCounted.h>
#include <LibCore/AnonymousBuffer.h>
#include <LibGfx/Color.h>
#include <LibGfx/Forward.h>
@ -62,7 +62,7 @@ inline StorageFormat determine_storage_format(BitmapFormat format)
struct BackingStore;
class Bitmap : public RefCounted<Bitmap> {
class Bitmap : public AtomicRefCounted<Bitmap> {
public:
[[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> create(BitmapFormat, IntSize);
[[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> create(BitmapFormat, AlphaType, IntSize);