summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--editor/editor_data.cpp4
-rw-r--r--editor/editor_undo_redo_manager.cpp4
-rw-r--r--editor/editor_undo_redo_manager.h1
-rw-r--r--platform/web/detect.py3
-rw-r--r--scene/2d/physics_body_2d.cpp4
-rw-r--r--scene/3d/physics_body_3d.cpp4
6 files changed, 17 insertions, 3 deletions
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index 786e841c21..b4cf6d8de1 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -649,7 +649,9 @@ void EditorData::remove_scene(int p_idx) {
EditorNode::get_singleton()->emit_signal("scene_closed", edited_scene[p_idx].path);
}
- undo_redo_manager->discard_history(edited_scene[p_idx].history_id);
+ if (undo_redo_manager->has_history(edited_scene[p_idx].history_id)) { // Might not exist if scene failed to load.
+ undo_redo_manager->discard_history(edited_scene[p_idx].history_id);
+ }
edited_scene.remove_at(p_idx);
}
diff --git a/editor/editor_undo_redo_manager.cpp b/editor/editor_undo_redo_manager.cpp
index c2491f8611..94f76dbc41 100644
--- a/editor/editor_undo_redo_manager.cpp
+++ b/editor/editor_undo_redo_manager.cpp
@@ -375,6 +375,10 @@ bool EditorUndoRedoManager::has_redo() {
return false;
}
+bool EditorUndoRedoManager::has_history(int p_idx) const {
+ return history_map.has(p_idx);
+}
+
void EditorUndoRedoManager::clear_history(bool p_increase_version, int p_idx) {
if (p_idx != INVALID_HISTORY) {
History &history = get_or_create_history(p_idx);
diff --git a/editor/editor_undo_redo_manager.h b/editor/editor_undo_redo_manager.h
index effa36a87c..e8c782871c 100644
--- a/editor/editor_undo_redo_manager.h
+++ b/editor/editor_undo_redo_manager.h
@@ -130,6 +130,7 @@ public:
bool is_history_unsaved(int p_idx);
bool has_undo();
bool has_redo();
+ bool has_history(int p_idx) const;
String get_current_action_name();
int get_current_action_history_id();
diff --git a/platform/web/detect.py b/platform/web/detect.py
index 7deec7b593..89cdab9fa4 100644
--- a/platform/web/detect.py
+++ b/platform/web/detect.py
@@ -234,6 +234,9 @@ def configure(env: "Environment"):
# Workaround https://github.com/emscripten-core/emscripten/issues/19781.
if cc_semver >= (3, 1, 42) and cc_semver < (3, 1, 46):
env.Append(LINKFLAGS=["-Wl,-u,scalbnf"])
+ # Workaround https://github.com/emscripten-core/emscripten/issues/16836.
+ if cc_semver >= (3, 1, 47):
+ env.Append(LINKFLAGS=["-Wl,-u,_emscripten_run_callback_on_thread"])
if env["dlink_enabled"]:
if env["proxy_to_pthread"]:
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index 7a131916e8..af9008f452 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -147,7 +147,9 @@ bool PhysicsBody2D::test_move(const Transform2D &p_from, const Vector2 &p_motion
}
Vector2 PhysicsBody2D::get_gravity() const {
- return PhysicsServer2D::get_singleton()->body_get_direct_state(get_rid())->get_total_gravity();
+ PhysicsDirectBodyState2D *state = PhysicsServer2D::get_singleton()->body_get_direct_state(get_rid());
+ ERR_FAIL_NULL_V(state, Vector2());
+ return state->get_total_gravity();
}
TypedArray<PhysicsBody2D> PhysicsBody2D::get_collision_exceptions() {
diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp
index 1f78928b94..7d08d767c7 100644
--- a/scene/3d/physics_body_3d.cpp
+++ b/scene/3d/physics_body_3d.cpp
@@ -189,7 +189,9 @@ bool PhysicsBody3D::test_move(const Transform3D &p_from, const Vector3 &p_motion
}
Vector3 PhysicsBody3D::get_gravity() const {
- return PhysicsServer3D::get_singleton()->body_get_direct_state(get_rid())->get_total_gravity();
+ PhysicsDirectBodyState3D *state = PhysicsServer3D::get_singleton()->body_get_direct_state(get_rid());
+ ERR_FAIL_NULL_V(state, Vector3());
+ return state->get_total_gravity();
}
void PhysicsBody3D::set_axis_lock(PhysicsServer3D::BodyAxis p_axis, bool p_lock) {