nmwsharp / nmwsharp/polyscope

Callback functions for shutdown()?

Open
#201 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hi, I encountered an issue that seems need some customization to the shutdown() function:

I have a separate thread initiated and detached before polyscope::init() -- a server listening from other software for sending geometries in.

The server use a shared_ptr<UIState> which is also used in the main().

Now if I close the main window of polyscope, there's always an error pointing to the ~shared_ptr<UIState>.

I'm not 100% sure what happened there, but it seems the main thread delete the shared_ptr<UIState> before the other thread exit. And when the server tries to delete that shared_ptr, it points to nowhere?

I assume manually exit the separate thread before the main should help.

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.

Research direction

Read the shutdown() entry point and the UIState ownership and lifetime paths described in the report. Determine how a shutdown hook could let the detached server stop before shared state is destroyed, then verify that closing the main window completes without the reported shared_ptr error.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.