瀏覽代碼

Merge pull request #9239 from lethiandev/master

Fix image lock on preview image generating
George Marques 8 年之前
父節點
當前提交
9583ecf7e8
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      editor/plugins/editor_preview_plugins.cpp

+ 2 - 1
editor/plugins/editor_preview_plugins.cpp

@@ -427,13 +427,14 @@ Ref<Texture> EditorScriptPreviewPlugin::generate(const RES &p_from) {
 	Color text_color = EditorSettings::get_singleton()->get("text_editor/highlighting/text_color");
 	Color text_color = EditorSettings::get_singleton()->get("text_editor/highlighting/text_color");
 	Color symbol_color = EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color");
 	Color symbol_color = EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color");
 
 
+	img->lock();
+
 	for (int i = 0; i < thumbnail_size; i++) {
 	for (int i = 0; i < thumbnail_size; i++) {
 		for (int j = 0; j < thumbnail_size; j++) {
 		for (int j = 0; j < thumbnail_size; j++) {
 			img->put_pixel(i, j, bg_color);
 			img->put_pixel(i, j, bg_color);
 		}
 		}
 	}
 	}
 
 
-	img->lock();
 	bool prev_is_text = false;
 	bool prev_is_text = false;
 	bool in_keyword = false;
 	bool in_keyword = false;
 	for (int i = 0; i < code.length(); i++) {
 	for (int i = 0; i < code.length(); i++) {