The safer mode is to use PostDeferredCallToThread to permit discarding the panel in the same thread where it was loaded. If the panel was loaded in the main thread, you can simply use PostDeferredCall that implicitly calls a function in the main thread.