polyscope icon indicating copy to clipboard operation
polyscope copied to clipboard

Callback functions for shutdown()?

Open xarthurx opened this issue 2 years ago • 2 comments

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.

xarthurx avatar Mar 17 '23 15:03 xarthurx

Hi! I'm not sure I understand this in terms of Polyscope. Do you think there's a bug on the Polyscope side? Or what is the new Polyscope feature you would want, a callback function that gets called on shutdown()?

nmwsharp avatar May 01 '23 05:05 nmwsharp

I'm not sure if this is a bug on the polyscope side... but a callback func for shutdown() definitely help. But as I've used a different mechanism to avoid the issue here, this is not urgent for me at the moment.

You may consider the proposal from polyscope's own good.

xarthurx avatar May 01 '23 08:05 xarthurx