Skip to content

Commit

Permalink
dont destroy graphic, deincrementUseCount to ensure its uncached
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Sep 30, 2024
1 parent 2c1ee77 commit da27e83
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions haxe/ui/backend/ComponentImpl.hx
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,11 @@ class ComponentImpl extends ComponentBase {
var h:Int = Std.int(height * Toolkit.scaleY);
if (_surface.width != w || _surface.height != h) {
if (w <= 0 || h <= 0) {
_surface.graphic.destroy();
_surface.graphic.decrementUseCount();
_surface.makeGraphic(1, 1, 0x0, true);
_surface.visible = false;
} else {
_surface.graphic.destroy();
_surface.graphic.decrementUseCount();
_surface.makeGraphic(w, h, 0x0, true);
applyStyle(style);
}
Expand Down Expand Up @@ -881,6 +881,7 @@ class ComponentImpl extends ComponentBase {
private var _destroyed:Bool = false;
private function destroyInternal() {
if (_surface != null) {
_surface.graphic.decrementUseCount();
_surface.destroy();
_surface = null;
}
Expand Down

0 comments on commit da27e83

Please sign in to comment.