0 votes

My source code


// MainScreen.hpp include <Godot.hpp> include <String.hpp> include <Control.hpp> include <EditorPlugin.hpp> using namespace godot; class MainScreen : public EditorPlugin {
GODOTCLASS(MainScreen, EditorPlugin)
public:
static void _register
methods(); bool has_main_screen(); Ref<Texture> 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.

Godot version 3.2 ~ 3.2.3-stable-1725-g18e72c735e
in Engine by (12 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.