fix: tray garbage collection (#33040)
This commit is contained in:
parent
8cf345660c
commit
c5a2af7811
2 changed files with 7 additions and 2 deletions
|
@ -89,8 +89,10 @@ gin::Handle<Tray> Tray::New(gin_helper::ErrorThrower thrower,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return gin::CreateHandle(thrower.isolate(),
|
auto handle = gin::CreateHandle(args->isolate(),
|
||||||
new Tray(args->isolate(), image, guid));
|
new Tray(args->isolate(), image, guid));
|
||||||
|
handle->Pin(args->isolate());
|
||||||
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tray::OnClicked(const gfx::Rect& bounds,
|
void Tray::OnClicked(const gfx::Rect& bounds,
|
||||||
|
@ -180,6 +182,7 @@ void Tray::OnDragEnded() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tray::Destroy() {
|
void Tray::Destroy() {
|
||||||
|
Unpin();
|
||||||
menu_.Reset();
|
menu_.Reset();
|
||||||
tray_icon_.reset();
|
tray_icon_.reset();
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "shell/common/gin_helper/cleaned_up_at_exit.h"
|
#include "shell/common/gin_helper/cleaned_up_at_exit.h"
|
||||||
#include "shell/common/gin_helper/constructible.h"
|
#include "shell/common/gin_helper/constructible.h"
|
||||||
#include "shell/common/gin_helper/error_thrower.h"
|
#include "shell/common/gin_helper/error_thrower.h"
|
||||||
|
#include "shell/common/gin_helper/pinnable.h"
|
||||||
|
|
||||||
namespace gfx {
|
namespace gfx {
|
||||||
class Image;
|
class Image;
|
||||||
|
@ -38,6 +39,7 @@ class Tray : public gin::Wrappable<Tray>,
|
||||||
public gin_helper::EventEmitterMixin<Tray>,
|
public gin_helper::EventEmitterMixin<Tray>,
|
||||||
public gin_helper::Constructible<Tray>,
|
public gin_helper::Constructible<Tray>,
|
||||||
public gin_helper::CleanedUpAtExit,
|
public gin_helper::CleanedUpAtExit,
|
||||||
|
public gin_helper::Pinnable<Tray>,
|
||||||
public TrayIconObserver {
|
public TrayIconObserver {
|
||||||
public:
|
public:
|
||||||
// gin_helper::Constructible
|
// gin_helper::Constructible
|
||||||
|
|
Loading…
Reference in a new issue