mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0031769: Application Framework - regression : can not initialize two kinds of application in one thread
This commit is contained in:
@@ -42,7 +42,17 @@ Handle(TObj_Application) TObj_Application::GetInstance()
|
||||
Handle(CDF_Session) aSession = CDF_Session::Create();
|
||||
Handle(CDF_Application) anApp;
|
||||
if (aSession->FindApplication(OSD_Thread::Current(), anApp))
|
||||
return Handle(TObj_Application)::DownCast(anApp);
|
||||
{
|
||||
Handle(TObj_Application) aTObjApp = Handle(TObj_Application)::DownCast(anApp);
|
||||
if (!aTObjApp.IsNull())
|
||||
return aTObjApp;
|
||||
// If in session application of another type is already registered, use this global
|
||||
// application, alone, outside of the session (as a workaround for DRAW scripting where
|
||||
// many kinds of applications can be required).
|
||||
static Handle(TObj_Application) THE_TOBJ_APP(new TObj_Application);
|
||||
return THE_TOBJ_APP;
|
||||
}
|
||||
// It will register this application in the session.
|
||||
return new TObj_Application;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user