mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0023209: Potentially unmatched XOpenDisplay() and XCloseDisplay() calls in some OCCT packages
Fixed display connection management in Draw_Window
This commit is contained in:
parent
da21902312
commit
a6a9658686
@ -181,7 +181,12 @@ Standard_Boolean Draw_BlackBackGround = Standard_True;
|
|||||||
//======================================================
|
//======================================================
|
||||||
Draw_Window* Draw_Window::firstWindow = NULL;
|
Draw_Window* Draw_Window::firstWindow = NULL;
|
||||||
|
|
||||||
|
// X11 specific part
|
||||||
#if !defined(__APPLE__) || defined(MACOSX_USE_GLX)
|
#if !defined(__APPLE__) || defined(MACOSX_USE_GLX)
|
||||||
|
#include <Aspect_DisplayConnection.hxx>
|
||||||
|
|
||||||
|
static Handle(Aspect_DisplayConnection) Draw_DisplayConnection;
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Draw_Window
|
//function : Draw_Window
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -1091,17 +1096,21 @@ Standard_Boolean Init_Appli()
|
|||||||
Tk_GeometryRequest(mainWindow, 200, 200);
|
Tk_GeometryRequest(mainWindow, 200, 200);
|
||||||
|
|
||||||
#if !defined(__APPLE__) || defined(MACOSX_USE_GLX)
|
#if !defined(__APPLE__) || defined(MACOSX_USE_GLX)
|
||||||
if (Draw_WindowDisplay == NULL) {
|
if (Draw_DisplayConnection.IsNull())
|
||||||
Draw_WindowDisplay = XOpenDisplay(NULL);
|
{
|
||||||
// Replaced Tk_Display(mainWindow) with XOpenDisplay; On Mac OS X Tk_Display
|
try
|
||||||
// returns a pointer to Display structure defined in system Tcl/Tk libraries.
|
{
|
||||||
// This structure differs from structure defined in X11 library and
|
Draw_DisplayConnection = new Aspect_DisplayConnection();
|
||||||
// this caused DRAWEXE crash on startup.
|
}
|
||||||
|
catch (Standard_Failure)
|
||||||
|
{
|
||||||
|
std::cout << "Cannot open display. Interpret commands in batch mode." << std::endl;
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (Draw_WindowDisplay == NULL) {
|
if (Draw_WindowDisplay == NULL)
|
||||||
cout << "Cannot open display : "<<XDisplayName(NULL)<<endl;
|
{
|
||||||
cout << "Interpret commands in batch mode."<<endl;
|
Draw_WindowDisplay = Draw_DisplayConnection->GetDisplay();
|
||||||
return Standard_False;
|
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// synchronize the display server : could be done within Tk_Init
|
// synchronize the display server : could be done within Tk_Init
|
||||||
|
Loading…
x
Reference in New Issue
Block a user