Jump to content
  • Advertisement
Sign in to follow this  

AngelScript class destructor causes segfault

Recommended Posts

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
        // Wait for all rendering to be finished
        // Destroy the window and render device instance


Share this post

Link to post
Share on other sites

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.



Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!