Fix issues with CreateInstanceName, a virtual function, being called
in an initializer. llvm-svn: 114107
This commit is contained in:
parent
20154b3ed4
commit
9e41c15d84
|
@ -392,6 +392,9 @@ public:
|
||||||
static const ConstString &
|
static const ConstString &
|
||||||
GetDefaultName ();
|
GetDefaultName ();
|
||||||
|
|
||||||
|
static const ConstString &
|
||||||
|
InvalidName ();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
UserSettingsController &m_owner;
|
UserSettingsController &m_owner;
|
||||||
|
|
|
@ -639,13 +639,20 @@ Debugger::DebuggerInstanceSettings::ValidTermWidthValue (const char *value, Erro
|
||||||
|
|
||||||
DebuggerInstanceSettings::DebuggerInstanceSettings (UserSettingsController &owner, bool live_instance,
|
DebuggerInstanceSettings::DebuggerInstanceSettings (UserSettingsController &owner, bool live_instance,
|
||||||
const char *name) :
|
const char *name) :
|
||||||
InstanceSettings (owner, (name == NULL ? CreateInstanceName ().AsCString() : name), live_instance),
|
InstanceSettings (owner, (name == NULL ? InstanceSettings::InvalidName().AsCString() : name), live_instance),
|
||||||
m_prompt (),
|
m_prompt (),
|
||||||
m_script_lang ()
|
m_script_lang ()
|
||||||
{
|
{
|
||||||
// CopyInstanceSettings is a pure virtual function in InstanceSettings; it therefore cannot be called
|
// CopyInstanceSettings is a pure virtual function in InstanceSettings; it therefore cannot be called
|
||||||
// until the vtables for DebuggerInstanceSettings are properly set up, i.e. AFTER all the initializers.
|
// until the vtables for DebuggerInstanceSettings are properly set up, i.e. AFTER all the initializers.
|
||||||
// For this reason it has to be called here, rather than in the initializer or in the parent constructor.
|
// For this reason it has to be called here, rather than in the initializer or in the parent constructor.
|
||||||
|
// The same is true of CreateInstanceName().
|
||||||
|
|
||||||
|
if (GetInstanceName() == InstanceSettings::InvalidName())
|
||||||
|
{
|
||||||
|
ChangeInstanceName (std::string (CreateInstanceName().AsCString()));
|
||||||
|
m_owner.RegisterInstanceSettings (this);
|
||||||
|
}
|
||||||
|
|
||||||
if (live_instance)
|
if (live_instance)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2187,6 +2187,7 @@ InstanceSettings::InstanceSettings (UserSettingsController &owner, const char *i
|
||||||
m_instance_name (instance_name)
|
m_instance_name (instance_name)
|
||||||
{
|
{
|
||||||
if ((m_instance_name != InstanceSettings::GetDefaultName())
|
if ((m_instance_name != InstanceSettings::GetDefaultName())
|
||||||
|
&& (m_instance_name != InstanceSettings::InvalidName())
|
||||||
&& live_instance)
|
&& live_instance)
|
||||||
m_owner.RegisterInstanceSettings (this);
|
m_owner.RegisterInstanceSettings (this);
|
||||||
}
|
}
|
||||||
|
@ -2205,6 +2206,14 @@ InstanceSettings::GetDefaultName ()
|
||||||
return g_default_settings_name;
|
return g_default_settings_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ConstString &
|
||||||
|
InstanceSettings::InvalidName ()
|
||||||
|
{
|
||||||
|
static const ConstString g_invalid_name ("Invalid instance name");
|
||||||
|
|
||||||
|
return g_invalid_name;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
InstanceSettings::ChangeInstanceName (const std::string &new_instance_name)
|
InstanceSettings::ChangeInstanceName (const std::string &new_instance_name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1876,7 +1876,7 @@ Process::ProcessSettingsController::CreateNewInstanceSettings (const char *insta
|
||||||
|
|
||||||
ProcessInstanceSettings::ProcessInstanceSettings (UserSettingsController &owner, bool live_instance,
|
ProcessInstanceSettings::ProcessInstanceSettings (UserSettingsController &owner, bool live_instance,
|
||||||
const char *name) :
|
const char *name) :
|
||||||
InstanceSettings (owner, (name == NULL ? CreateInstanceName().AsCString() : name), live_instance),
|
InstanceSettings (owner, (name == NULL ? InstanceSettings::InvalidName().AsCString() : name), live_instance),
|
||||||
m_run_args (),
|
m_run_args (),
|
||||||
m_env_vars (),
|
m_env_vars (),
|
||||||
m_input_path (),
|
m_input_path (),
|
||||||
|
@ -1888,6 +1888,13 @@ ProcessInstanceSettings::ProcessInstanceSettings (UserSettingsController &owner,
|
||||||
// CopyInstanceSettings is a pure virtual function in InstanceSettings; it therefore cannot be called
|
// CopyInstanceSettings is a pure virtual function in InstanceSettings; it therefore cannot be called
|
||||||
// until the vtables for ProcessInstanceSettings are properly set up, i.e. AFTER all the initializers.
|
// until the vtables for ProcessInstanceSettings are properly set up, i.e. AFTER all the initializers.
|
||||||
// For this reason it has to be called here, rather than in the initializer or in the parent constructor.
|
// For this reason it has to be called here, rather than in the initializer or in the parent constructor.
|
||||||
|
// This is true for CreateInstanceName() too.
|
||||||
|
|
||||||
|
if (GetInstanceName () == InstanceSettings::InvalidName())
|
||||||
|
{
|
||||||
|
ChangeInstanceName (std::string (CreateInstanceName().AsCString()));
|
||||||
|
m_owner.RegisterInstanceSettings (this);
|
||||||
|
}
|
||||||
|
|
||||||
if (live_instance)
|
if (live_instance)
|
||||||
{
|
{
|
||||||
|
|
|
@ -967,12 +967,19 @@ Thread::ThreadSettingsController::CreateNewInstanceSettings (const char *instanc
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
|
|
||||||
ThreadInstanceSettings::ThreadInstanceSettings (UserSettingsController &owner, bool live_instance, const char *name) :
|
ThreadInstanceSettings::ThreadInstanceSettings (UserSettingsController &owner, bool live_instance, const char *name) :
|
||||||
InstanceSettings (owner, (name == NULL ? CreateInstanceName().AsCString() : name), live_instance),
|
InstanceSettings (owner, (name == NULL ? InstanceSettings::InvalidName().AsCString() : name), live_instance),
|
||||||
m_avoid_regexp_ap ()
|
m_avoid_regexp_ap ()
|
||||||
{
|
{
|
||||||
// CopyInstanceSettings is a pure virtual function in InstanceSettings; it therefore cannot be called
|
// CopyInstanceSettings is a pure virtual function in InstanceSettings; it therefore cannot be called
|
||||||
// until the vtables for ThreadInstanceSettings are properly set up, i.e. AFTER all the initializers.
|
// until the vtables for ThreadInstanceSettings are properly set up, i.e. AFTER all the initializers.
|
||||||
// For this reason it has to be called here, rather than in the initializer or in the parent constructor.
|
// For this reason it has to be called here, rather than in the initializer or in the parent constructor.
|
||||||
|
// This is true for CreateInstanceName() too.
|
||||||
|
|
||||||
|
if (GetInstanceName() == InstanceSettings::InvalidName())
|
||||||
|
{
|
||||||
|
ChangeInstanceName (std::string (CreateInstanceName().AsCString()));
|
||||||
|
m_owner.RegisterInstanceSettings (this);
|
||||||
|
}
|
||||||
|
|
||||||
if (live_instance)
|
if (live_instance)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue