Fail to properly unregister extension - extension object is still alive - Kit 106.3.0

[Warning] [omni.ext._impl._internal] xxxxxx.combined.variants-1.0.0 → <class ‘xxxxxx.combined.variants.extension.CombinedVariantSetEditor’>: extension object is still alive, something holds a reference on it. References: [“[0]:type: <class ‘method’>, id: 1843184037248”]

Hi there, I’m banging my head against this error generated when unregistering an extension involving menu entries and a file picker window. Interestingly, some NVIDIA extensions such as omni.kit.variant.editor produce the exact same error upon unregistering. It would appear that I am missing some trick in on_shutdown when cleaning up. Any ideas?

1 Like

Thanks for posting the question. I will ask one of kit devs to see if they can help.

This can be tricky to solve. Typically it’s something like:

  • If you register a callback you need to deregister it
  • If you create a ui you need to destroy it (recursively)

Can you take a look at this document and see if that helps?

I know this is a little old, but I was battling this and the issue with the window not closing properly. I was able to find the answer digging into other tools and finding the best solution in the extension.py for omni.kit.window.commands. Solution below:

  • Add MenuHelperExtensionFull and add to your Extension Class
from omni.kit.menu.utils import MenuHelperExtensionFull

class Extension(omni.ext.IExt, MenuHelperExtensionFull):
  • in on_startup add self.menu_startup
def on_startup(self):
    self.menu_startup(create_window_fn=lambda:Window(WINDOW_NAME), window_name=WINDOW_NAME, menu_desc="Some Text", menu_group="Window")
  • in on_shutdown call self.menu_shutdown
def on_shutdown(self):
    self.menu_shutdown()

MenuHelperExtensionFull is documented in the omni.kit.menu.utils docs.

Hope this helps others save time in the future.

1 Like

Thanks Eric

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.