karim.salama Posted September 7, 2023 Posted September 7, 2023 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 : Any idea what could be wrong? Thanks in advance.
silent Posted September 8, 2023 Posted September 8, 2023 Hi Karim, Could you please tell what this plugin should actually do and how do you plan to use it? Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
karim.salama Posted September 8, 2023 Author Posted September 8, 2023 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++.
karim.salama Posted September 8, 2023 Author Posted September 8, 2023 I added the plugin to the editor using the -extern_plugin command argument.
victor Posted September 8, 2023 Posted September 8, 2023 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(); }
karim.salama Posted September 8, 2023 Author Posted September 8, 2023 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.
victor Posted September 11, 2023 Posted September 11, 2023 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: 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. Please pay attention on it and correct with the right value. 1
karim.salama Posted September 11, 2023 Author Posted September 11, 2023 That must be it. Thank you. I will try this and tell you how it went.
Recommended Posts