DiscussionsIssue archiveOCCT:Application Framework

Archived issue #0025525

TObj_Model shoulde not call its virtual method GetApplication() in constructor.

CommunityOCCT:Application Frameworknew0 public notes

Search issues

Description

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();
}

Steps to reproduce

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.

Public activity

No public notes

Participants are labeled by their role within this record.