Fix order of operations in shutdown

* When calling OnCaptureClosed now this is book-ended so called *while* the
  capture is opened. Do not refresh and repopulate EventBrowser cache.
This commit is contained in:
baldurk
2026-09-11 15:03:59 +01:00
parent 60c83d0483
commit 2ada3ed28d
2 changed files with 19 additions and 7 deletions
+13 -2
View File
@@ -1848,10 +1848,21 @@ An interface implemented by any object wanting to be notified of capture events.
)");
struct ICaptureViewer
{
DOCUMENT("Called whenever a capture is opened.");
DOCUMENT(R"(Called immediately after a capture is opened, while the capture is open.
Although this allows access to capture information, this callback will be called while the UI is also
populating as well (the order for capture viewers including UI panels is undefined) so it is recommended
not to do much in this callback beyond any initialisation and access to underlying capture information.
)");
virtual void OnCaptureLoaded() = 0;
DOCUMENT("Called whenever a capture is closed.");
DOCUMENT(R"(Called immediately before a capture is closed, while the capture is open.
As with :meth:`OnCaptureLoaded` this will be called while the UI is closing down so it is strongly
recommended that you do no work apart from releasing resources and clearing any caches in this function.
If you want to run code after the capture has closed you can issue a delayed callback, which will be
guaranteed not to be called until after the capture is completely closed.
)");
virtual void OnCaptureClosed() = 0;
DOCUMENT(R"(Called whenever the current selected event changes. This is distinct from the actual
+6 -5
View File
@@ -225,7 +225,7 @@ struct EventItemModel : public QAbstractItemModel
.arg(paramcol.blue(), 2, 16, QLatin1Char('0'));
}
void ResetModel()
void ResetModel(bool closing)
{
emit beginResetModel();
emit endResetModel();
@@ -238,7 +238,7 @@ struct EventItemModel : public QAbstractItemModel
m_Chunks.clear();
m_Times.clear();
if(!m_Ctx.CurRootActions().empty())
if(!closing && !m_Ctx.CurRootActions().empty())
m_Nodes[0] = CreateActionNode(NULL);
m_CurrentEID = createIndex(0, 0, TagCaptureStart);
@@ -250,7 +250,8 @@ struct EventItemModel : public QAbstractItemModel
m_FindString.clear();
m_FindEIDSearch = false;
RefreshCache();
if(!closing)
RefreshCache();
}
void RefreshCache()
@@ -4058,7 +4059,7 @@ void EventBrowser::OnCaptureLoaded()
// older Qt versions lose all the sections when a model resets even if the sections don't change.
// Manually save/restore them
QVariant p = persistData();
m_Model->ResetModel();
m_Model->ResetModel(false);
setPersistData(p);
// expand the root frame node
@@ -4101,7 +4102,7 @@ void EventBrowser::OnCaptureClosed()
// older Qt versions lose all the sections when a model resets even if the sections don't change.
// Manually save/restore them
QVariant p = persistData();
m_Model->ResetModel();
m_Model->ResetModel(true);
setPersistData(p);
ui->find->setEnabled(false);