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:
parent
e74f32ae40
commit
0808d5158c
3 changed files with 11 additions and 5 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue