Skip to content

Commit 1444565

Browse files
committed
Avoid crash with GTK3 if console program is linked to GUI library
A console program should not really be linked with the GUI library, but it used to work, and it's unavoidable with the monolithic build, so fix the regression. See wxWidgets#23981 (cherry picked from commit 4cabfa1)
1 parent 5560e59 commit 1444565

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/gtk/settings.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "wx/settings.h"
1414

1515
#ifndef WX_PRECOMP
16+
#include "wx/app.h"
1617
#include "wx/toplevel.h"
1718
#include "wx/module.h"
1819
#endif
@@ -1210,6 +1211,10 @@ bool wxSystemSettingsModule::OnInit()
12101211

12111212
m_proxy = NULL;
12121213

1214+
wxAppConsole* app = wxAppConsole::GetInstance();
1215+
if (!app || !app->IsGUI())
1216+
return true;
1217+
12131218
// GTK_THEME environment variable overrides other settings
12141219
if (getenv("GTK_THEME") == NULL)
12151220
{

0 commit comments

Comments
 (0)