Skip to content

Commit

Permalink
Merge pull request #82861 from mihe/gdext-entry-false
Browse files Browse the repository at this point in the history
Fix extensions loading/initializing even when entry point fails
  • Loading branch information
akien-mga committed Oct 5, 2023
2 parents 950139e + 5c6353a commit 7c56631
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/extension/gdextension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,7 @@ Error GDExtension::open_library(const String &p_path, const String &p_entry_symb
return OK;
} else {
ERR_PRINT("GDExtension initialization function '" + p_entry_symbol + "' returned an error.");
OS::get_singleton()->close_dynamic_library(library);
return FAILED;
}
}
Expand Down Expand Up @@ -928,6 +929,10 @@ Error GDExtensionResourceLoader::load_gdextension_resource(const String &p_path,
DirAccess::remove_absolute(p_extension->get_temp_library_path());
}
#endif

// Unreference the extension so that this loading can be considered a failure.
p_extension.unref();

// Errors already logged in open_library()
return err;
}
Expand Down

0 comments on commit 7c56631

Please sign in to comment.