AngelScript class destructor causes segfault

Started by
2 comments, last by howie_007 5 years, 4 months ago

In my game engine which used Vulkan, I'm setting it up so that a game can be completely written in AngelScript. One of my functions that I bound in AngelScript is a call that tells Vulkan to wait for idle. Before you can free assets, you need to be sure they are not in the rendering pipeline so in the AngelScript destructor, I'm doing that before further cleanup.

Calling these functions from the AngelScript class destructor causes a segment fault. I can call these same functions anywhere else in the AngelScript class but not from the destructor. Is the destructor doing something different?


class CGame
{
    ~CGame()
    {
        // Wait for all rendering to be finished
        Device.waitForIdle();
        
        // Destroy the window and render device instance
        Device.destroy();
    }

 

Advertisement

The destructor works just like any other function in AngelScript. The only difference is that it is called by the garbage collector when verified that there are no more references to the object (which may not necessarily be when you think it is).

Make sure the Device is still valid when the garbage collector destroys the objects, e.g. call engine->ShutDownAndRelease before you destroy the Vulkan Device.

 

 

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Wow, that solved the problem, thanks!

This topic is closed to new replies.

Advertisement