Merge pull request #76798 from KoBeWi/race_condition_except_there_is_no_thread

Fix another collision shape editor crash
This commit is contained in:
Rémi Verschelde 2023-05-08 12:20:57 +02:00
commit 41f1ec1efe
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 6 additions and 6 deletions

View File

@ -441,7 +441,7 @@ void CollisionShape2DEditor::forward_canvas_draw_over_viewport(Control *p_overla
switch (shape_type) { switch (shape_type) {
case CAPSULE_SHAPE: { case CAPSULE_SHAPE: {
Ref<CapsuleShape2D> shape = node->get_shape(); Ref<CapsuleShape2D> shape = current_shape;
handles.resize(2); handles.resize(2);
float radius = shape->get_radius(); float radius = shape->get_radius();
@ -456,7 +456,7 @@ void CollisionShape2DEditor::forward_canvas_draw_over_viewport(Control *p_overla
} break; } break;
case CIRCLE_SHAPE: { case CIRCLE_SHAPE: {
Ref<CircleShape2D> shape = node->get_shape(); Ref<CircleShape2D> shape = current_shape;
handles.resize(1); handles.resize(1);
handles.write[0] = Point2(shape->get_radius(), 0); handles.write[0] = Point2(shape->get_radius(), 0);
@ -472,7 +472,7 @@ void CollisionShape2DEditor::forward_canvas_draw_over_viewport(Control *p_overla
} break; } break;
case WORLD_BOUNDARY_SHAPE: { case WORLD_BOUNDARY_SHAPE: {
Ref<WorldBoundaryShape2D> shape = node->get_shape(); Ref<WorldBoundaryShape2D> shape = current_shape;
handles.resize(2); handles.resize(2);
handles.write[0] = shape->get_normal() * shape->get_distance(); handles.write[0] = shape->get_normal() * shape->get_distance();
@ -484,7 +484,7 @@ void CollisionShape2DEditor::forward_canvas_draw_over_viewport(Control *p_overla
} break; } break;
case SEPARATION_RAY_SHAPE: { case SEPARATION_RAY_SHAPE: {
Ref<SeparationRayShape2D> shape = node->get_shape(); Ref<SeparationRayShape2D> shape = current_shape;
handles.resize(1); handles.resize(1);
handles.write[0] = Point2(0, shape->get_length()); handles.write[0] = Point2(0, shape->get_length());
@ -494,7 +494,7 @@ void CollisionShape2DEditor::forward_canvas_draw_over_viewport(Control *p_overla
} break; } break;
case RECTANGLE_SHAPE: { case RECTANGLE_SHAPE: {
Ref<RectangleShape2D> shape = node->get_shape(); Ref<RectangleShape2D> shape = current_shape;
handles.resize(8); handles.resize(8);
Vector2 ext = shape->get_size() / 2; Vector2 ext = shape->get_size() / 2;
@ -506,7 +506,7 @@ void CollisionShape2DEditor::forward_canvas_draw_over_viewport(Control *p_overla
} break; } break;
case SEGMENT_SHAPE: { case SEGMENT_SHAPE: {
Ref<SegmentShape2D> shape = node->get_shape(); Ref<SegmentShape2D> shape = current_shape;
handles.resize(2); handles.resize(2);
handles.write[0] = shape->get_a(); handles.write[0] = shape->get_a();