debugger: properly clone breakpoints

This commit is contained in:
hjk
2010-06-22 14:52:26 +02:00
parent cda5f5d69b
commit b01a622fa3
2 changed files with 21 additions and 21 deletions

View File

@@ -173,25 +173,23 @@ BreakpointData::BreakpointData()
useFullPath = false; useFullPath = false;
} }
BreakpointData::BreakpointData(const BreakpointData &other) BreakpointData *BreakpointData::clone() const
{ {
//qDebug() << "COPYING BREAKPOINT " << other.toString(); BreakpointData *data = new BreakpointData();
pending = true; data->m_handler = m_handler;
marker = 0; data->m_markerFileName = m_markerFileName;
data->m_markerLineNumber = m_markerLineNumber;
m_handler = other.m_handler; data->enabled = enabled;
m_markerFileName = other.m_markerFileName; data->type = type;
m_markerLineNumber = other.m_markerLineNumber; data->fileName = fileName;
enabled = other.enabled; data->condition = condition;
type = other.type; data->ignoreCount = ignoreCount;
fileName = other.fileName; data->lineNumber = lineNumber;
condition = other.condition; data->address = address;
ignoreCount = other.ignoreCount; data->threadSpec = threadSpec;
lineNumber = other.lineNumber; data->funcName = funcName;
address = other.address; data->useFullPath = useFullPath;
threadSpec = other.threadSpec; return data;
funcName = other.funcName;
useFullPath = other.useFullPath;
} }
BreakpointData::~BreakpointData() BreakpointData::~BreakpointData()
@@ -1016,7 +1014,9 @@ void BreakHandler::breakByFunction(const QString &functionName)
void BreakHandler::initializeFromTemplate(BreakHandler *other) void BreakHandler::initializeFromTemplate(BreakHandler *other)
{ {
//qDebug() << "COPYING BREAKPOINTS INTO NEW SESSION"; //qDebug() << "COPYING BREAKPOINTS INTO NEW SESSION";
m_bp = other->m_bp; QTC_ASSERT(m_bp.isEmpty(), /**/);
foreach (BreakpointData *data, other->m_bp)
m_bp.append(data->clone());
updateMarkers(); updateMarkers();
} }

View File

@@ -63,13 +63,13 @@ public:
bool isSimilarTo(const BreakpointData *needle) const; bool isSimilarTo(const BreakpointData *needle) const;
bool conditionsMatch() const; bool conditionsMatch() const;
protected: BreakpointData *clone() const;
// This copies only the static data. // This copies only the static data.
BreakpointData(const BreakpointData &);
private: private:
// Intentionally unimplemented. // Intentionally unimplemented.
// Making it copyable is tricky because of the markers. // Making it copyable is tricky because of the markers.
BreakpointData(const BreakpointData &);
void operator=(const BreakpointData &); void operator=(const BreakpointData &);
// Our owner // Our owner