mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 10:29:19 +02:00
fix python window double-free
This commit is contained in:
@@ -470,7 +470,7 @@ void eu07_application::on_focus_change(bool focus) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
GLFWwindow *
|
GLFWwindow *
|
||||||
eu07_application::window( int const Windowindex, bool visible, int width, int height, GLFWmonitor *monitor ) {
|
eu07_application::window( int const Windowindex, bool visible, int width, int height, GLFWmonitor *monitor, bool keep_ownership ) {
|
||||||
|
|
||||||
if( Windowindex >= 0 ) {
|
if( Windowindex >= 0 ) {
|
||||||
return (
|
return (
|
||||||
@@ -483,9 +483,11 @@ eu07_application::window( int const Windowindex, bool visible, int width, int he
|
|||||||
glfwWindowHint( GLFW_VISIBLE, visible );
|
glfwWindowHint( GLFW_VISIBLE, visible );
|
||||||
|
|
||||||
auto *childwindow = glfwCreateWindow( width, height, "eu07helper", monitor, m_windows.front() );
|
auto *childwindow = glfwCreateWindow( width, height, "eu07helper", monitor, m_windows.front() );
|
||||||
if( childwindow != nullptr ) {
|
if (!childwindow)
|
||||||
m_windows.emplace_back( childwindow );
|
return nullptr;
|
||||||
}
|
|
||||||
|
if (keep_ownership)
|
||||||
|
m_windows.emplace_back( childwindow );
|
||||||
|
|
||||||
glfwFocusWindow(m_windows.front()); // restore focus to main window
|
glfwFocusWindow(m_windows.front()); // restore focus to main window
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public:
|
|||||||
on_focus_change(bool focus);
|
on_focus_change(bool focus);
|
||||||
// gives access to specified window, creates a new window if index == -1
|
// gives access to specified window, creates a new window if index == -1
|
||||||
GLFWwindow *
|
GLFWwindow *
|
||||||
window(int const Windowindex = 0 , bool visible = false, int width = 1, int height = 1, GLFWmonitor *monitor = nullptr);
|
window(int const Windowindex = 0 , bool visible = false, int width = 1, int height = 1, GLFWmonitor *monitor = nullptr, bool keep_ownership = true);
|
||||||
GLFWmonitor *
|
GLFWmonitor *
|
||||||
find_monitor(const std::string &str);
|
find_monitor(const std::string &str);
|
||||||
// generate network sync verification number
|
// generate network sync verification number
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ python_screen_viewer::python_screen_viewer(GLuint src, std::string surfacename)
|
|||||||
conf.offset = viewport.offset;
|
conf.offset = viewport.offset;
|
||||||
conf.scale = viewport.scale;
|
conf.scale = viewport.scale;
|
||||||
conf.window = Application.window(-1, true, conf.size.x, conf.size.y,
|
conf.window = Application.window(-1, true, conf.size.x, conf.size.y,
|
||||||
Application.find_monitor(viewport.monitor));
|
Application.find_monitor(viewport.monitor), false);
|
||||||
|
|
||||||
glfwSetWindowUserPointer(conf.window, this);
|
glfwSetWindowUserPointer(conf.window, this);
|
||||||
glfwSetFramebufferSizeCallback(conf.window, texture_window_fb_resize);
|
glfwSetFramebufferSizeCallback(conf.window, texture_window_fb_resize);
|
||||||
|
|||||||
Reference in New Issue
Block a user