Skip to content

Commit

Permalink
Merge pull request #7667 from AThousandShips/file_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mhilbrunner committed Aug 1, 2023
1 parent a69f17a commit 8c25bbe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tutorials/scripting/gdscript/gdscript_basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1750,9 +1750,9 @@ Here is an example:
var my_file_ref

func _ready():
var f = File.new()
var f = FileAccess.open("user://example_file.json", FileAccess.READ)
my_file_ref = weakref(f)
# the File class inherits RefCounted, so it will be freed when not in use
# the FileAccess class inherits RefCounted, so it will be freed when not in use

# the WeakRef will not prevent f from being freed when other_node is finished
other_node.use_file(f)
Expand Down

0 comments on commit 8c25bbe

Please sign in to comment.