Editor plugin crashes editor if reloadable is on

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By saqcu42s

My source code

// MainScreen.hpp
#include 
#include 
#include 
#include 

using namespace godot;

class MainScreen : public EditorPlugin {
	GODOT_CLASS(MainScreen, EditorPlugin)
public:
	static void _register_methods();

```
bool has_main_screen();

Ref get_plugin_icon();

String get_plugin_name();
```
};
// MainScreen.cpp
#include 
#include 

#include "MainScreen.hpp"

using namespace godot;

void MainScreen::_register_methods() {
	register_method("has_main_screen", &MainScreen::has_main_screen);
	register_method("get_plugin_icon", &MainScreen::get_plugin_icon);
	register_method("get_plugin_name", &MainScreen::get_plugin_name);
}

bool MainScreen::has_main_screen()
{
	return true;
}

godot::String MainScreen::get_plugin_name()
{
	return String("Main Screen");	
}

Ref MainScreen::get_plugin_icon()
{
  return get_editor_interface()->get_base_control()->get_icon("Node", "EditorIcons");
}

extern "C" void GDN_EXPORT godot_gdnative_init(godot_gdnative_init_options *o) {
	godot::Godot::gdnative_init(o);
}

extern "C" void GDN_EXPORT godot_nativescript_init(void *handle) {
	godot::Godot::nativescript_init(handle);

```
godot::register_tool_class<MainScreen>();
```
}

extern "C" void GDN_EXPORT godot_gdnative_terminate(godot_gdnative_terminate_options *o) {
	godot::Godot::gdnative_terminate(o);
}

if reloadable in .gdnlib is on, while plugin is enabled, unfocus editor window then refocus editor window, and do something to plugin (eg, click “Main Screen” button on top of window) or just quit from editor, godot crashes with segmentation fault.