mirror of
https://github.com/lightsoutgames/godot-accessibility.git
synced 2024-11-22 03:45:56 +00:00
Use WeakRef
to avoid double-free of timers.
This commit is contained in:
parent
d9c740abd6
commit
9051f381fe
|
@ -494,11 +494,11 @@ var timer
|
||||||
func unfocused():
|
func unfocused():
|
||||||
print_debug("Unfocused")
|
print_debug("Unfocused")
|
||||||
position_in_children = 0
|
position_in_children = 0
|
||||||
timer = node.get_tree().create_timer(1)
|
timer = weakref(node.get_tree().create_timer(1))
|
||||||
yield(timer, "timeout")
|
yield(timer.get_ref(), "timeout")
|
||||||
if not node.get_focus_owner():
|
if not node.get_focus_owner():
|
||||||
node.get_tree().root.warp_mouse(node.rect_global_position)
|
node.get_tree().root.warp_mouse(node.rect_global_position)
|
||||||
timer.unreference()
|
timer.get_ref().unreference()
|
||||||
|
|
||||||
func click_focused():
|
func click_focused():
|
||||||
if node.has_focus():
|
if node.has_focus():
|
||||||
|
@ -628,5 +628,5 @@ func _init(node):
|
||||||
node.connect("tree_exiting", self, "queue_free", [], Object.CONNECT_DEFERRED)
|
node.connect("tree_exiting", self, "queue_free", [], Object.CONNECT_DEFERRED)
|
||||||
|
|
||||||
func _exit_tree():
|
func _exit_tree():
|
||||||
if timer != null:
|
if timer != null and timer.get_ref():
|
||||||
timer.unreference()
|
timer.get_ref().unreference()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user