Jump to content

[SOLVED] [2.16.1 plugin] Unigine::EngineWindow::create crashes when loading an engine plugin in the editor


photo

Recommended Posts

Posted

Hi,

I'm making an Engine Plugin that has some GUI in C++ (Unigine 2.16.1) and was trying to create a Unigine::EngineWindow.

The editor crashes in the init function (where Unigine::EngineWindow::create is called). It seems that the crash is happening because engine.system_proxy in Unigine::WindowManager is null. Here is the callstack :

image.png.a7ed660b4ac15700b8ca977fd54331df.png

Any idea what could be wrong?

Thanks in advance.

Posted

Hi silent,

This is a port of a plugin from version 2.6.1. It has a simple UI to help with (railway) content creation.

This tool was made in C++ and UnigineScript, but now it's only C++.

Posted

I added the plugin to the editor using the -extern_plugin command argument.

Posted

Hello,

This sounds impossible - `engine.system_proxy in Unigine::WindowManager is null` for the case when the Engine is loading plugins, because the `system_proxy` pointer is set before loading plugins.

Does it happen without loading of your plugin?

If this crash happens only with your plugin, could you send a minimal example of a plugin? Or could you send an example of code and point the place in your code, where you create a window?

Because I've tried to create `EngineWindowViewport` in a plugin just to check creation and it works well:

int MyPlugin::init()
{
  	Log::message("Create a window\n");
	auto w = EngineWindowViewport::create(500, 500);
	Log::message("Created = %p\n", w.get());
	w.deleteLater();
}

 

Posted

minimal.zip

Hi Victor,

I added a minimal example where this error occurs.

By the way, I'm using Unigine 2.16.1, so Unigine::EngineWindowViewport is not available. I'm using Unigine::EngineWindow.

Posted

Hi Karim,

It was very interesting to find a reason. 

You linked your Debug plugin with the Release Unigine lib (Unigine_double_x64.lib). You can see it on this picture:

image.png

And then when you launch the Debug Editor application (Editor_double_x64d.exe) your plugin calls the function from the Release Unigine dll (Unigine_double_x64.dll), which is not initialized, then the crash happens. That's why I wasn't able to reproduce such a crash on Linux and Windows in my projects.

In your Visual Studio project I see the usage of the $(UnigineLibType) variable which must be different for Debug and Release configuration.

image.png

Please pay attention on it and correct with the right value.

  • Thanks 1
Posted

That must be it. Thank you.

I will try this and tell you how it went.

  • silent changed the title to [SOLVED] [2.16.1 plugin] Unigine::EngineWindow::create crashes when loading an engine plugin in the editor
×
×
  • Create New...