nanogui icon indicating copy to clipboard operation
nanogui copied to clipboard

Application cleanup question

Open Tom94 opened this issue 4 years ago • 1 comments

I noticed that on the latest version of nanogui, the Screen object (and its inheriting example applications) are never destructed. Is this intentional?

Destroying an application manually leads to a hard-crash with some reference counts dipping below zero.

For now, my workaround is to never destroy my application and to instead put all necessary cleanup into main(). But that seems a little hacky.

Related question: what is the purpose of the inc_ref and dec_ref calls in example1.cpp? Exception-related? If so, why are they not present in all other examples?

Tom94 avatar Jul 25 '21 08:07 Tom94

Hi @Tom94,

indeed, there are some reference counting issues involving the Screen at the moment. It's related to a reference cycle involving the RenderPass. It's on my TODO list but may take some time to get to. I'd suggest that you use your workaround for now. -W

wjakob avatar Jul 25 '21 21:07 wjakob

FYI, this reference cycle issue is now fixed in on master. For details, see https://github.com/mitsuba-renderer/nanogui/commit/77b8d98a90223d6e0eb72188a619fbb153ef6c47 and https://github.com/mitsuba-renderer/nanogui/commit/e3dcfc51a9473d71e8cfb4e7f3020c6219051e03.

wjakob avatar Oct 25 '22 16:10 wjakob