From b01a622fa3f496791165001383b229eb7737efab Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Tue, 22 Jun 2010 14:52:26 +0200 Subject: [PATCH] debugger: properly clone breakpoints --- src/plugins/debugger/breakhandler.cpp | 38 +++++++++++++-------------- src/plugins/debugger/breakpoint.h | 4 +-- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp index f4dca3be9dd..1df3f703692 100644 --- a/src/plugins/debugger/breakhandler.cpp +++ b/src/plugins/debugger/breakhandler.cpp @@ -173,25 +173,23 @@ BreakpointData::BreakpointData() useFullPath = false; } -BreakpointData::BreakpointData(const BreakpointData &other) +BreakpointData *BreakpointData::clone() const { - //qDebug() << "COPYING BREAKPOINT " << other.toString(); - pending = true; - marker = 0; - - m_handler = other.m_handler; - m_markerFileName = other.m_markerFileName; - m_markerLineNumber = other.m_markerLineNumber; - enabled = other.enabled; - type = other.type; - fileName = other.fileName; - condition = other.condition; - ignoreCount = other.ignoreCount; - lineNumber = other.lineNumber; - address = other.address; - threadSpec = other.threadSpec; - funcName = other.funcName; - useFullPath = other.useFullPath; + BreakpointData *data = new BreakpointData(); + data->m_handler = m_handler; + data->m_markerFileName = m_markerFileName; + data->m_markerLineNumber = m_markerLineNumber; + data->enabled = enabled; + data->type = type; + data->fileName = fileName; + data->condition = condition; + data->ignoreCount = ignoreCount; + data->lineNumber = lineNumber; + data->address = address; + data->threadSpec = threadSpec; + data->funcName = funcName; + data->useFullPath = useFullPath; + return data; } BreakpointData::~BreakpointData() @@ -1016,7 +1014,9 @@ void BreakHandler::breakByFunction(const QString &functionName) void BreakHandler::initializeFromTemplate(BreakHandler *other) { //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(); } diff --git a/src/plugins/debugger/breakpoint.h b/src/plugins/debugger/breakpoint.h index b6044dbc9c8..e12367c3ebd 100644 --- a/src/plugins/debugger/breakpoint.h +++ b/src/plugins/debugger/breakpoint.h @@ -63,13 +63,13 @@ public: bool isSimilarTo(const BreakpointData *needle) const; bool conditionsMatch() const; -protected: + BreakpointData *clone() const; // This copies only the static data. - BreakpointData(const BreakpointData &); private: // Intentionally unimplemented. // Making it copyable is tricky because of the markers. + BreakpointData(const BreakpointData &); void operator=(const BreakpointData &); // Our owner -- GitLab