Browse Source

Merge pull request #101182 from stuartcarnie/editor_crash_import

Editor: Fix crash when using `--import --verbose` due to use-after-free
Rémi Verschelde 7 months ago
parent
commit
21a6bd8dca
2 changed files with 9 additions and 0 deletions
  1. 8 0
      editor/editor_resource_preview.cpp
  2. 1 0
      editor/editor_resource_preview.h

+ 8 - 0
editor/editor_resource_preview.cpp

@@ -522,6 +522,14 @@ void EditorResourcePreview::_bind_methods() {
 	ADD_SIGNAL(MethodInfo("preview_invalidated", PropertyInfo(Variant::STRING, "path")));
 }
 
+void EditorResourcePreview::_notification(int p_what) {
+	switch (p_what) {
+		case NOTIFICATION_EXIT_TREE: {
+			stop();
+		} break;
+	}
+}
+
 void EditorResourcePreview::check_for_invalidation(const String &p_path) {
 	bool call_invalidated = false;
 	{

+ 1 - 0
editor/editor_resource_preview.h

@@ -123,6 +123,7 @@ class EditorResourcePreview : public Node {
 	void _update_thumbnail_sizes();
 
 protected:
+	void _notification(int p_what);
 	static void _bind_methods();
 
 public: