Skip to content

Expose OS.disable_crash_handler() for extensions #108268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions core/core_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,10 @@ void OS::remove_logger(const Ref<Logger> &p_logger) {
logger_bind->loggers.erase(p_logger);
}

void OS::disable_crash_handler() {
::OS::get_singleton()->disable_crash_handler();
}

void OS::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_entropy", "size"), &OS::get_entropy);
ClassDB::bind_method(D_METHOD("get_system_ca_certificates"), &OS::get_system_ca_certificates);
Expand Down Expand Up @@ -834,6 +838,8 @@ void OS::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_logger", "logger"), &OS::add_logger);
ClassDB::bind_method(D_METHOD("remove_logger", "logger"), &OS::remove_logger);

ClassDB::bind_method(D_METHOD("disable_crash_handler"), &OS::disable_crash_handler);

ADD_PROPERTY(PropertyInfo(Variant::BOOL, "low_processor_usage_mode"), "set_low_processor_usage_mode", "is_in_low_processor_usage_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "low_processor_usage_mode_sleep_usec"), "set_low_processor_usage_mode_sleep_usec", "get_low_processor_usage_mode_sleep_usec");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "delta_smoothing"), "set_delta_smoothing", "is_delta_smoothing_enabled");
Expand Down
2 changes: 2 additions & 0 deletions core/core_bind.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ class OS : public Object {
void add_logger(const Ref<Logger> &p_logger);
void remove_logger(const Ref<Logger> &p_logger);

void disable_crash_handler();

static OS *get_singleton() { return singleton; }

OS();
Expand Down
6 changes: 6 additions & 0 deletions doc/classes/OS.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@
[b]Note:[/b] When [method delay_usec] is called on the main thread, it will freeze the project and will prevent it from redrawing and registering input until the delay has passed. When using [method delay_usec] as part of an [EditorPlugin] or [EditorScript], it will freeze the editor but won't freeze the project if it is currently running (since the project is an independent child process).
</description>
</method>
<method name="disable_crash_handler">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd name it disable_default_crash_handler. or "built-in"

Since this could seem to indicate, otherwise, that all crash handlers would be disabled. While the intent is to disable only the built in so another can be registered instead.

<return type="void" />
<description>
Disables the crash handler. Useful for extensions that want to register their own crash handlers.
</description>
</method>
<method name="execute">
<return type="int" />
<param index="0" name="path" type="String" />
Expand Down