Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Segmentation fault during shutdown on WSL

Open
#336 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp

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.

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...

Dominant language
C++
Stars
2.2k
Forks
242
Avg merge
11m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nmwsharp/polyscope

All issues in nmwsharp/polyscope

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.