Segmentation fault during shutdown on WSL
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 242
- Avg merge
- 11m
- Merged PRs (30d)
- 1
Description
I have this simple program:
#include <polyscope/polyscope.h>
#include <polyscope/surface_mesh.h>
int main()
{
polyscope::init();
std::vector<std::array<double, 3>> vertices{{0, 0, 0}, {1, 0, 0}, {1, 1, 0}};
std::vector<std::array<int, 3>> faces{{0, 1, 2}};
std::vector<double> scalars{0.0, 1.0, 2.0};
polyscope::registerSurfaceMesh("my mesh", vertices, faces);
polyscope::getSurfaceMesh("my mesh")->addVertexScalarQuantity("my_scalar", scalars)->setEnabled(true);
polyscope::show();
}
I'm running it on WSL, backend:
[polyscope] Backend: openGL3_glfw -- Loaded openGL version: 4.1 (Core Profile) Mesa 23.2.1-1ubuntu3.1~22.04.3
Polyscope is at the latest master version (except the very latest commit which breaks compilation btw).
The program runs fine, but when I close the window, I get
Segmentation fault (core dumped)
I debugged into it and the crash happens at gl_engine.cpp, in the destructor of GLTextureBuffer:
GLTextureBuffer::~GLTextureBuffer() {
glDeleteTextures(1, &handle);
}
The call to glDeleteTextures is still reached, and the crash seems to happen within it. I verified that handle is a reasonable-looking number (34 in my case). If I remove setEnabled(true) and don't manually enable the scalar field either, the crash goes away. Let me know if I can provide any more info to debug this...
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the shutdown crash on WSL with the supplied C++ program, focusing on the enabled scalar quantity. Start at gl_engine.cpp in GLTextureBuffer::~GLTextureBuffer(), where glDeleteTextures is reported to fail; done means closing the window no longer causes a segmentation fault, including when setEnabled(true) is used.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100