Don't crash on startup of console programs in monolithic wxX11 build.
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
This commit is contained in:
parent
d66ddd70c7
commit
f18b415ee3
1 changed files with 9 additions and 0 deletions
|
|
@ -1747,6 +1747,15 @@ IMPLEMENT_DYNAMIC_CLASS(wxWinModule, wxModule)
|
|||
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 );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue