diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index f336d7de9d2d5c78c9af1ce67f25ecffbf54f58a..9f49e082de76d630bf5bde6886f2bfb8797e015b 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -225,6 +225,7 @@ public slots: void scheduleResetLocation() { m_stackHandler.scheduleResetLocation(); + m_threadsHandler.scheduleResetLocation(); m_disassemblerAgent.scheduleResetLocation(); m_locationTimer.setSingleShot(true); m_locationTimer.start(80); @@ -235,6 +236,7 @@ public slots: m_locationTimer.stop(); m_locationMark.reset(); m_stackHandler.resetLocation(); + m_threadsHandler.resetLocation(); m_disassemblerAgent.resetLocation(); } diff --git a/src/plugins/debugger/threadshandler.cpp b/src/plugins/debugger/threadshandler.cpp index aed7c61217c54c86c43416e2302e4c254d0be674..1a384bccf590f0e3632873c0ebfa5240b067e70b 100644 --- a/src/plugins/debugger/threadshandler.cpp +++ b/src/plugins/debugger/threadshandler.cpp @@ -104,6 +104,8 @@ ThreadsHandler::ThreadsHandler() m_positionIcon(QLatin1String(":/debugger/images/location_16.png")), m_emptyIcon(QLatin1String(":/debugger/images/debugger_empty_14.png")) { + m_resetLocationScheduled = false; + m_contentsValid = false; } int ThreadsHandler::rowCount(const QModelIndex &parent) const @@ -194,6 +196,11 @@ QVariant ThreadsHandler::headerData return QVariant(); } +Qt::ItemFlags ThreadsHandler::flags(const QModelIndex &index) const +{ + return m_contentsValid ? QAbstractTableModel::flags(index) : Qt::ItemFlags(0); +} + int ThreadsHandler::currentThreadId() const { if (m_currentIndex < 0 || m_currentIndex >= m_threads.size()) @@ -241,7 +248,9 @@ void ThreadsHandler::setThreads(const Threads &threads) m_threads = threads; if (m_currentIndex >= m_threads.size()) m_currentIndex = -1; - layoutChanged(); + m_resetLocationScheduled = false; + m_contentsValid = true; + reset(); } Threads ThreadsHandler::threads() const @@ -253,7 +262,7 @@ void ThreadsHandler::removeAll() { m_threads.clear(); m_currentIndex = 0; - layoutChanged(); + reset(); } void ThreadsHandler::notifyRunning() @@ -303,5 +312,19 @@ Threads ThreadsHandler::parseGdbmiThreads(const GdbMi &data, int *currentThread) return threads; } +void ThreadsHandler::scheduleResetLocation() +{ + m_resetLocationScheduled = true; + m_contentsValid = false; +} + +void ThreadsHandler::resetLocation() +{ + if (m_resetLocationScheduled) { + m_resetLocationScheduled = false; + reset(); + } +} + } // namespace Internal } // namespace Debugger diff --git a/src/plugins/debugger/threadshandler.h b/src/plugins/debugger/threadshandler.h index f4d2c6e597dae10c2e5108b54829573f5bda52a8..cf86d0a751ba21b90495ffde2dcf253107f86172 100644 --- a/src/plugins/debugger/threadshandler.h +++ b/src/plugins/debugger/threadshandler.h @@ -70,17 +70,24 @@ public: static Threads parseGdbmiThreads(const GdbMi &data, int *currentThread = 0); + void resetLocation(); + void scheduleResetLocation(); + private: int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + Qt::ItemFlags flags(const QModelIndex &index) const; Threads m_threads; int m_currentIndex; const QIcon m_positionIcon; const QIcon m_emptyIcon; + + bool m_resetLocationScheduled; + bool m_contentsValid; }; } // namespace Internal