Skip to content

Commit

Permalink
Allow generating extension api headless.
Browse files Browse the repository at this point in the history
  • Loading branch information
fire committed Sep 19, 2021
1 parent b1063a7 commit b6629c7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/extension/extension_api_dump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,9 @@ void NativeExtensionAPIDump::generate_extension_json_file(const String &p_path)
json.instantiate();

String text = json->stringify(api, "\t", false);
FileAccessRef fa = FileAccess::open(p_path, FileAccess::WRITE);
Error err;
FileAccessRef fa = FileAccess::open(p_path, FileAccess::WRITE, &err);
ERR_FAIL_COND(err != OK);
CharString cs = text.ascii();
fa->store_buffer((const uint8_t *)cs.ptr(), cs.length());
fa->close();
Expand Down
3 changes: 3 additions & 0 deletions scene/main/canvas_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1304,5 +1304,8 @@ CanvasTexture::CanvasTexture() {
canvas_texture = RS::get_singleton()->canvas_texture_create();
}
CanvasTexture::~CanvasTexture() {
if (canvas_texture.is_null()) {
return;
}
RS::get_singleton()->free(canvas_texture);
}
3 changes: 3 additions & 0 deletions scene/resources/shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ Shader::Shader() {
}

Shader::~Shader() {
if (shader.is_null()) {
return;
}
RenderingServer::get_singleton()->free(shader);
}

Expand Down

0 comments on commit b6629c7

Please sign in to comment.