Fix issues with CreateInstanceName, a virtual function, being called
in an initializer.
llvm-svn: 114107
diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index 7fa6491..9bc244b 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -967,12 +967,19 @@
//--------------------------------------------------------------
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 ()
{
// 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.
// 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)
{