When using monolithic build, GUI-specific wxWinModule is still linked in but
its initialization crashes because there is no global display. Simply don't do
anything in this module OnInit() in this case to avoid the problem (which
affected e.g. wxrc in this build configuration).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67678
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
bool wxWinModule::OnInit()
{
Display *xdisplay = wxGlobalDisplay();
+ if ( !xdisplay )
+ {
+ // This module may be linked into a console program when using
+ // monolithic library and in this case it's perfectly normal not to
+ // have a display, so just return without doing anything and avoid
+ // crashing below.
+ return true;
+ }
+
int xscreen = DefaultScreen( xdisplay );
Window xroot = RootWindow( xdisplay, xscreen );
g_eraseGC = XCreateGC( xdisplay, xroot, 0, NULL );