Skip to content

A little modification to solve "Segmentation fault" #6

Description

@oxidationreduction

Hi. In where2act/code/env.py and ditto/data_generation/env.py, this line of code in Env.close() may cause 'Segmentation fault'.

    def close(self):
        if self.show_gui:
            self.viewer.set_scene(None) # <- this line
        self.scene = None

Because it will pass a NoneType to a viewer, and the viewer will call self.window.set_scene(scene) to set the scene of the window to a null object, causing illegal memory access. Here's sapien's C++ source code.

void SVulkan2Window::setScene(SVulkan2Scene *scene) {
  mScene = scene;
  mSVulkanRenderer->setScene(mScene->getScene()); // mScene is null, crashed
}

So I suggest change Env.close() to

    def close(self):
        if self.show_gui:
            self.viewer.close()
        self.scene = None

to solve the problem.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions