Fix GLFW crash when Python exits while the passive viewer is running.
Fixes #790 PiperOrigin-RevId: 549440435 Change-Id: I808f6aaab6662225e5fe1131e0da72eca6011ba9
This commit is contained in:
committed by
Copybara-Service
parent
8386b28877
commit
f7847ba73e
@@ -110,6 +110,7 @@ GlfwAdapter::GlfwAdapter() {
|
||||
}
|
||||
|
||||
GlfwAdapter::~GlfwAdapter() {
|
||||
FreeMjrContext();
|
||||
Glfw().glfwMakeContextCurrent(nullptr);
|
||||
Glfw().glfwDestroyWindow(window_);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ PlatformUIAdapter::PlatformUIAdapter() {
|
||||
mjr_defaultContext(&con_);
|
||||
}
|
||||
|
||||
PlatformUIAdapter::~PlatformUIAdapter() {
|
||||
void PlatformUIAdapter::FreeMjrContext() {
|
||||
mjr_freeContext(&con_);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
namespace mujoco {
|
||||
class PlatformUIAdapter {
|
||||
public:
|
||||
virtual ~PlatformUIAdapter();
|
||||
virtual ~PlatformUIAdapter() = default;
|
||||
|
||||
inline mjuiState& state() { return state_; }
|
||||
inline const mjuiState& state() const { return state_; }
|
||||
@@ -38,7 +38,7 @@ class PlatformUIAdapter {
|
||||
layout_callback_ = layout_callback;
|
||||
}
|
||||
|
||||
// Optionally overrideable function to (re)create an mjrContext for an mjModel
|
||||
// Optionally overridable function to (re)create an mjrContext for an mjModel
|
||||
virtual bool RefreshMjrContext(const mjModel* m, int fontscale);
|
||||
|
||||
virtual bool EnsureContextSize();
|
||||
@@ -73,6 +73,7 @@ class PlatformUIAdapter {
|
||||
|
||||
protected:
|
||||
PlatformUIAdapter();
|
||||
void FreeMjrContext();
|
||||
|
||||
// Event handlers
|
||||
void OnFilesDrop(int count, const char** paths);
|
||||
|
||||
Reference in New Issue
Block a user