1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:07:34 +00:00

WindowServer: Make WSButton a Weakable and stop rawly pointing to it.

We had a crash due to dereferencing a destroyed WSButton after clicking
a window close button. Avoid that problem by using WeakPtr.
This commit is contained in:
Andreas Kling 2019-04-06 21:16:41 +02:00
parent e74f32ae40
commit 0808d5158c
3 changed files with 11 additions and 5 deletions

View file

@ -3,13 +3,14 @@
#include <SharedGraphics/Rect.h>
#include <AK/Function.h>
#include <AK/Retained.h>
#include <AK/Weakable.h>
class CharacterBitmap;
class Painter;
class WSMouseEvent;
class WSWindowFrame;
class WSButton final {
class WSButton : public Weakable<WSButton> {
public:
WSButton(WSWindowFrame&, Retained<CharacterBitmap>&&, Function<void()>&& on_click_handler);
~WSButton();