Skip to content

Commit

Permalink
fix: fixed exit callback not having access to dpg commands #1448 (#1458)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoffstadt committed Nov 29, 2021
1 parent aa936d9 commit 69aeb79
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 0 additions & 1 deletion DearPyGui/src/core/mvCallbackRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ namespace Marvel {
GContext->callbackRegistry->callCount--;
}

mvRunCallback(GContext->callbackRegistry->onCloseCallback, 0, nullptr, nullptr);
return true;
}

Expand Down
10 changes: 10 additions & 0 deletions DearPyGui/src/core/mvContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,16 @@ namespace Marvel {
return;
}

// hacky fix, started was set to false
// to exit the event loop, but needs to be
// true in order to run DPG commands for the
// exit callback.
GContext->started = true;
mvSubmitCallback([=]() {
mvRunCallback(GContext->callbackRegistry->onCloseCallback, 0, nullptr, nullptr);
GContext->started = false; // return to false after
});

imnodes::DestroyContext();
ImPlot::DestroyContext();
ImGui::DestroyContext();
Expand Down

0 comments on commit 69aeb79

Please sign in to comment.