MantisBT - Community
View Issue Details
0025525Community[OCCT] OCCT:Application Frameworkpublic2014-11-27 16:002017-05-25 15:23
Vico Liang 
mpv 
normalminor 
newopen 
WindowsVC++ 201364 bit
[OCCT] 6.8.0 
[OCCT] Unscheduled 
0025525: TObj_Model shoulde not call its virtual method GetApplication() in constructor.
Code snippet:
TObj_Model::TObj_Model ()
{
  myMessenger = GetApplication()->Messenger(); // VICO: Calling virtual method GetApplication().
}

const Handle(TObj_Application) TObj_Model::GetApplication()
{
  return TObj_Application::GetInstance();
}
Calling virtual method in constructor is not recommended.
It might not work as expected. It make user failed to derive TObj_Application even if user overrides the GetApplication() method in TObj_Model.
What about removing the codes in constructor? The Messenger can be set after model creation.
No tags attached.
Issue History
2014-11-27 16:00Vico LiangNew Issue
2014-11-27 16:00Vico LiangAssigned To => szy
2015-12-15 14:06abvTarget Version7.0.0 => 7.1.0
2016-02-17 18:19szyAssigned Toszy => mpv
2016-10-25 16:10mpvTarget Version7.1.0 => 7.2.0
2017-05-25 15:23mpvTarget Version7.2.0 => Unscheduled

There are no notes attached to this issue.