From 627f97f37e8aa67e183899253b3bba06df0316e0 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Wed, 29 Oct 2025 20:42:40 +0100 Subject: [PATCH 32/48] make sure command line apps are properly initialized on macOS --- src/unix/appunix.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/unix/appunix.cpp b/src/unix/appunix.cpp index cf7a1a6f49..3eb8d59144 100644 --- a/src/unix/appunix.cpp +++ b/src/unix/appunix.cpp @@ -20,6 +20,10 @@ #include "wx/private/fdiodispatcher.h" #include "wx/private/fdioeventloopsourcehandler.h" +#ifdef __DARWIN__ +#include "wx/osx/private.h" +#endif + #include #include @@ -86,6 +90,14 @@ wxAppConsole::~wxAppConsole() // same names bool wxAppConsole::Initialize(int& argc_, wxChar** argv_) { +#ifdef __DARWIN__ + // On command line apps on macOS we need to initialize Cocoa framework + wxMacAutoreleasePool autoreleasepool; +#if !defined(__WXOSX_IPHONE__) || !__WXOSX_IPHONE__ + wxMacInitCocoa(); +#endif +#endif // __DARWIN__ + if ( !wxAppConsoleBase::Initialize(argc_, argv_) ) return false; -- 2.24.3 (Apple Git-128)