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;
}
--- /dev/null
+puts "==========="
+puts "0031769: Application Framework - regression : can not initialize two kinds of application in one thread"
+puts "==========="
+
+# loading of ALL initializes TDOCStd_Application, loading TOBJ initializes TObj_Application
+pload ALL TOBJ