Portponky / better-terrain

Terrain plugin for Godot 4
The Unlicense
433 stars 21 forks source link

Leaked instances upon editor exit #77

Closed AstroStucky closed 3 months ago

AstroStucky commented 4 months ago

Since installing better-terrain into my project via the asset library I see leaked instances upon editor exit. This did not happen prior to installing better-terrain. I am using Godot v4.2.stable.official.46dc27791 on Ubuntu 22.04. My first clue at the leaks were these messages from Godot whenever I quit the editor

ERROR: 48 RID allocations of type 'P12GodotShape2D' were leaked at exit.
PulseAudio: context terminated
ERROR: 9 RID allocations of type 'N10RendererRD14TextureStorage7TextureE' were leaked at exit.
ERROR: 1 RID allocations of type 'N10RendererRD14TextureStorage13CanvasTextureE' were leaked at exit.
ERROR: 108 RID allocations of type 'N18RendererCanvasCull4ItemE' were leaked at exit.
WARNING: 15 RIDs of type "Texture" were leaked.
     at: finalize (drivers/vulkan/rendering_device_vulkan.cpp:9623)
ERROR: 55 RID allocations of type 'PN18TextServerAdvanced22ShapedTextDataAdvancedE' were leaked at exit.
ERROR: 17 RID allocations of type 'PN18TextServerAdvanced12FontAdvancedE' were leaked at exit.
ERROR: 1 RID allocations of type 'PN18TextServerAdvanced27FontAdvancedLinkedVariationE' were leaked at exit.
WARNING: ObjectDB instances leaked at exit (run with --verbose for details).

Running the godot editor with the --verbose flag reveals the following. What's listed here is just a subset of the leaked instance messages that contained resource paths relating to better-terrain.

Leaked instance: CompressedTexture2D:-9173452009930430530 - Resource path: res://addons/better-terrain/icons/MatchTiles.svg
Leaked instance: StyleBoxFlat:-9173401432395552833 - Resource path: res://addons/better-terrain/editor/TerrainEntry.tscn::StyleBoxFlat_rohyw
Leaked instance: CompressedTexture2D:-9173444313349036096 - Resource path: res://addons/better-terrain/icons/MatchVertices.svg
Leaked instance: GDScript:-9173422323116480575 - Resource path: res://addons/better-terrain/editor/TerrainEntry.gd
Leaked instance: CompressedTexture2D:-9173436616767641662 - Resource path: res://addons/better-terrain/icons/NonModifying.svg
Leaked instance: CompressedTexture2D:-9173407479709505597 - Resource path: res://addons/better-terrain/icons/Decoration.svg
Leaked instance: StyleBoxFlat:-9173402531907180601 - Resource path: res://addons/better-terrain/editor/TerrainEntry.tscn::StyleBoxFlat_3pdcc
Leaked instance: StyleBoxFlat:-9173400882639738936 - Resource path: res://addons/better-terrain/editor/TerrainEntry.tscn::StyleBoxFlat_xa0fl
Leaked instance: StyleBoxFlat:-9173400332883925047 - Resource path: res://addons/better-terrain/editor/TerrainEntry.tscn::StyleBoxFlat_b4rkm
Leaked instance: ImageTexture:-9170821428360973754 - Resource path:
Leaked instance: ConvexPolygonShape2D:-9163080866501429416 - Resource path:
Leaked instance: TileData:60291720109160287
Leaked instance: TileData:60290620597532513
Leaked instance: TileSetAtlasSource:-9163083065524684958 - Resource path: res://scene/level/stage1_pumpkinpatch/pumpkinpatch_tileset.tres::TileSetAtlasSource_dwpcm
Leaked instance: CompressedTexture2D:-9163088013327009949 - Resource path: res://asset/tilesets/pumpkin_patch/pumpkinpatch_floor_tileset.png
Portponky commented 3 months ago

I'll take a look at this soon. It's probably due to holding references after the editor tidies up.

Portponky commented 3 months ago

Fixed by commit 825dd0ebf5ea5f867b29d3f9ed39fb569cb93118

Portponky commented 3 months ago

Fix available in asset library version.