| 186 | } |
| 187 | |
| 188 | void SymbolTableView::populateSymbols(BinaryView &view) |
| 189 | { |
| 190 | if (auto controller = SharedCacheController::GetController(view)) { |
| 191 | typedef std::vector<CacheSymbol> SymbolList; |
| 192 | // Retrieve the symbols from the controller in a future than pass that to the model. |
| 193 | QPointer<QFutureWatcher<SymbolList>> watcher = new QFutureWatcher<SymbolList>(this); |
| 194 | connect(watcher, &QFutureWatcher<SymbolList>::finished, this, [watcher, this]() { |
| 195 | if (watcher) |
| 196 | { |
| 197 | auto symbols = watcher->result(); |
| 198 | m_model->updateSymbols(std::move(symbols)); |
| 199 | } |
| 200 | }); |
| 201 | QFuture<SymbolList> future = QtConcurrent::run([controller]() { |
| 202 | return controller->GetSymbols(); |
| 203 | }); |
| 204 | watcher->setFuture(future); |
| 205 | connect(this, &QObject::destroyed, this, [watcher]() { |
| 206 | if (watcher && watcher->isRunning()) { |
| 207 | watcher->cancel(); |
| 208 | watcher->waitForFinished(); |
| 209 | } |
| 210 | }); |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | void SymbolTableView::setFilter(const std::string& filter) { |
| 215 | m_model->setFilter(filter); |
no test coverage detected