| 1571 | } |
| 1572 | |
| 1573 | void MainWindow::removeDatasetData(DatasetId dataset_id) { |
| 1574 | if (dataset_id == active_streaming_dataset_id_) { |
| 1575 | if (streaming_manager_ != nullptr) { |
| 1576 | streaming_manager_->stopDatasetAndWait(dataset_id, tr("dataset removed")); |
| 1577 | } |
| 1578 | active_streaming_dataset_id_ = 0; |
| 1579 | streaming_playback_seeded_ = false; |
| 1580 | } |
| 1581 | // A REAL delete: erase the dataset's data from the object store AND the engine — |
| 1582 | // no tombstone — so a later load of the same source is a clean fresh load (mints |
| 1583 | // a new DatasetId), not a reattach to an emptied shell. |
| 1584 | // |
| 1585 | // Order matters. Invalidate the TF buffer first (it was built from these object |
| 1586 | // topics; invalidateDataset walks listTopics(dataset_id), empty once eviction |
| 1587 | // runs). Then evict the object payloads (so the catalog's itemsRemoved prunes |
| 1588 | // 2D/3D layers). Then drop the catalog items (tearing down every curve adapter). |
| 1589 | // ONLY THEN erase the engine's scalar storage: DataEngine::removeDataset requires |
| 1590 | // all readers/adapters invalidated first, which the synchronous teardown above guarantees. |
| 1591 | if (transform_service_ != nullptr) { |
| 1592 | transform_service_->invalidateDataset(dataset_id); |
| 1593 | } |
| 1594 | session_->sessionManager().evictDatasetObjects(dataset_id); |
| 1595 | session_->catalogModel().removeDataset(dataset_id, /*tombstone=*/false); |
| 1596 | session_->sessionManager().dataEngine().removeDataset(dataset_id); |
| 1597 | // Drop this dataset's file association (hygiene). Resurrection is prevented by |
| 1598 | // the layout-save liveness filter (appendDataSourceElement), not by mutating |
| 1599 | // loaded_sources_ — that list is kept whole so the quick-reload button still works. |
| 1600 | file_loader_->untrackDataset(dataset_id); |
| 1601 | } |
| 1602 | |
| 1603 | void MainWindow::onRemoveDatasetsRequested(const QList<DatasetId>& dataset_ids) { |
| 1604 | if (dataset_ids.isEmpty()) { |
nothing calls this directly
no test coverage detected