File tree Expand file tree Collapse file tree 3 files changed +31
-2
lines changed
godot-core/src/builtin/meta Expand file tree Collapse file tree 3 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -162,8 +162,9 @@ macro_rules! impl_signature_for_tuple {
162
162
unsafe { <$R as sys:: GodotFuncMarshal >:: try_write_sys( & ret_val, ret) }
163
163
. unwrap_or_else( |e| return_error:: <$R>( method_name, & e) ) ;
164
164
165
- // FIXME is inc_ref needed here?
166
- // std::mem::forget(ret_val);
165
+ //Note: we want to prevent the destructor from being run, since we pass ownership to the caller.
166
+ //https://github.com/godot-rust/gdext/pull/165
167
+ std:: mem:: forget( ret_val) ;
167
168
}
168
169
}
169
170
} ;
Original file line number Diff line number Diff line change
1
+ # This Source Code Form is subject to the terms of the Mozilla Public
2
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ # file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
+
5
+ extends ArrayTest
6
+
7
+ var test_suite : TestSuite = TestSuite .new ()
8
+
9
+ # In order to reproduce the bahevaior discovered in https://github.com/godot-rust/gdext/issues/138
10
+ # we must inherit a Godot Node. Because of this we can't just inherit TesSuite like the rest of the tests.
11
+ func assert_that (what : bool , message : String = "" ) -> bool :
12
+ return test_suite .assert_that (what , message )
13
+
14
+ func assert_eq (left , right , message : String = "" ) -> bool :
15
+ return test_suite .assert_eq (left , right , message )
16
+
17
+ # Called when the node enters the scene tree for the first time.
18
+ func _ready ():
19
+ pass
20
+
21
+ func test_vector_array_return_from_user_func ():
22
+ var array : Array = return_typed_array (2 )
23
+ assert_eq (array , [1 ,2 ])
24
+
25
+ # Called every frame. 'delta' is the elapsed time since the previous frame.
26
+ func _process (delta ):
27
+ pass
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ func _ready():
10
10
var gdscript_suites : Array = [
11
11
preload ("res://ManualFfiTests.gd" ).new (),
12
12
preload ("res://gen/GenFfiTests.gd" ).new (),
13
+ preload ("res://InheritTests.gd" ).new ()
13
14
]
14
15
15
16
var gdscript_tests : Array = []
You can’t perform that action at this time.
0 commit comments