| 94 | } |
| 95 | |
| 96 | void FrameStackModel::setFrames(int threadNumber, const QVector<FrameItem>& frames) |
| 97 | { |
| 98 | Q_D(FrameStackModel); |
| 99 | |
| 100 | QModelIndex threadIndex = d->indexForThreadNumber(threadNumber); |
| 101 | if (!threadIndex.isValid()) { |
| 102 | qCDebug(DEBUGGER).nospace() << "fetched " << frames.size() << " new frames for nonexistent thread #" |
| 103 | << threadNumber; |
| 104 | return; |
| 105 | } |
| 106 | |
| 107 | auto& threadFrames = d->m_frames[threadNumber]; |
| 108 | if (!threadFrames.empty()) { |
| 109 | beginRemoveRows(threadIndex, 0, threadFrames.size() - 1); |
| 110 | threadFrames.clear(); |
| 111 | endRemoveRows(); |
| 112 | } |
| 113 | |
| 114 | if (!frames.isEmpty()) { |
| 115 | beginInsertRows(threadIndex, 0, frames.count()-1); |
| 116 | threadFrames = frames; |
| 117 | endInsertRows(); |
| 118 | } |
| 119 | |
| 120 | if (d->m_currentThread == threadNumber && d->m_updateCurrentFrameOnNextFetch) { |
| 121 | d->m_currentFrame = 0; |
| 122 | d->m_updateCurrentFrameOnNextFetch = false; |
| 123 | } |
| 124 | |
| 125 | d->m_fileExistsCache.clear(); |
| 126 | |
| 127 | session()->raiseEvent(IDebugSession::thread_or_frame_changed); |
| 128 | |
| 129 | // FIXME: Ugly hack. Apparently, when rows are added, the selection |
| 130 | // in the view is cleared. Emit this so that some frame is still |
| 131 | // selected. |
| 132 | emit currentFrameChanged(d->m_currentFrame); |
| 133 | } |
| 134 | |
| 135 | void FrameStackModel::insertFrames(int threadNumber, const QVector<FrameItem>& frames) |
| 136 | { |
no test coverage detected