From: Thomas Debesse Date: Mon, 21 Dec 2020 13:34:33 +0000 (+0100) Subject: macos: workaround faulty destructor X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=86efbe2cc889cc14809e9e0a49835ad140353c24;p=xonotic%2Fnetradiant.git macos: workaround faulty destructor --- diff --git a/CMakeLists.txt b/CMakeLists.txt index d4a31b5f..3d78aa47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -202,6 +202,12 @@ if (BUILD_RADIANT) add_definitions(-DWORKAROUND_WINDOWS_GTK2_GLWIDGET=1) endif () endif () + + if (APPLE) + if (GTK_TARGET EQUAL 2) + add_definitions(-DWORKAROUND_MACOS_GTK2_DESTROY=1) + endif () + endif () endif () #----------------------------------------------------------------------- diff --git a/libs/gtkutil/xorrectangle.cpp b/libs/gtkutil/xorrectangle.cpp index c638e0e2..ab15ac88 100644 --- a/libs/gtkutil/xorrectangle.cpp +++ b/libs/gtkutil/xorrectangle.cpp @@ -35,7 +35,9 @@ XORRectangle::XORRectangle(ui::GLArea widget) : m_widget(widget), cr(0) XORRectangle::~XORRectangle() { if (initialised()) { +#ifndef WORKAROUND_MACOS_GTK2_DESTROY cairo_destroy(cr); +#endif } } diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 8a7691af..b43a5522 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -2775,10 +2775,14 @@ MainFrame::~MainFrame(){ for ( std::vector::iterator i = g_floating_windows.begin(); i != g_floating_windows.end(); ++i ) { +#ifndef WORKAROUND_MACOS_GTK2_DESTROY i->destroy(); +#endif } +#ifndef WORKAROUND_MACOS_GTK2_DESTROY m_window.destroy(); +#endif } void MainFrame::SetActiveXY( XYWnd* p ){