]> git.cworth.org Git - vogl/commitdiff
UI: Fix support for taking snapshots after an edited & outdated snapshot.
authorPeter Lohrmann <plohrmann@upsamplesoftware.com>
Thu, 13 Mar 2014 21:41:28 +0000 (14:41 -0700)
committerCarl Worth <cworth@cworth.org>
Tue, 1 Apr 2014 19:37:28 +0000 (12:37 -0700)
* Also fix algorithm that finds the previous snapshot for diff'ing purposes so that it only returns valid snapshots.

(cherry picked from commit 9734f7d774470c4efe2cc0b9858d873fcc55850d)

src/vogleditor/vogleditor.cpp
src/vogleditor/vogleditor_qstatetreemodel.cpp
src/vogleditor/vogleditor_tracereplayer.cpp

index 24a7097a9d046b30aef044de160dfcb3bb124379..a7c199cabdca2e3ffd166e834d2471076bdeeb89 100644 (file)
@@ -1246,7 +1246,7 @@ void VoglEditor::reset_snapshot_ui()
 vogleditor_gl_state_snapshot* VoglEditor::findMostRecentSnapshot_helper(vogleditor_apiCallTreeItem* pItem, vogleditor_gl_state_snapshot*& pMostRecentSnapshot, const vogleditor_gl_state_snapshot* pCurSnapshot)
 {
     // check if this item has a snapshot shot
-    if (pItem->has_snapshot())
+    if (pItem->has_snapshot() && pItem->get_snapshot()->is_valid())
     {
         vogleditor_gl_state_snapshot* pTmp = pItem->get_snapshot();
         if (pTmp == pCurSnapshot)
@@ -1330,8 +1330,7 @@ void VoglEditor::update_ui_for_snapshot(vogleditor_gl_state_snapshot* pStateSnap
    // state viewer
    vogleditor_QStateTreeModel* pStateModel = new vogleditor_QStateTreeModel(NULL);
 
-   vogleditor_QApiCallTreeModel* pTreeModel = static_cast<vogleditor_QApiCallTreeModel*>(ui->treeView->model());
-   vogleditor_gl_state_snapshot* pBaseSnapshot = findMostRecentSnapshot(pTreeModel->root(), m_currentSnapshot);
+   vogleditor_gl_state_snapshot* pBaseSnapshot = findMostRecentSnapshot(m_pApicallTreeModel->root(), m_currentSnapshot);
    pStateModel->set_diff_base_snapshot(pBaseSnapshot);
 
    pStateModel->set_snapshot(pStateSnapshot);
index 610bd1b6bdaf1638cef17b17a70f43d5cb33e348..7a0b1fc9f88d9dc30e9144cad62e67164188087c 100644 (file)
@@ -167,7 +167,7 @@ void vogleditor_QStateTreeModel::setupModelData(vogleditor_gl_state_snapshot* pS
 
         const vogl_context_desc& desc = pContext->get_context_desc();
         vogleditor_stateTreeContextItem* pContextItem = new vogleditor_stateTreeContextItem(tmp.sprintf("Context %p", (void*)desc.get_trace_context()), "", parent, *pContext);
-        if (m_pBaseSnapshot != NULL && m_pBaseSnapshot->get_contexts().size() > 0 && m_pBaseSnapshot->get_contexts().at(c) != NULL)
+        if (m_pBaseSnapshot != NULL && m_pBaseSnapshot->is_valid() && m_pBaseSnapshot->get_contexts().size() > 0 && m_pBaseSnapshot->get_contexts().at(c) != NULL)
         {
             // set the diff state to be the same state, so that there does not appear to be any diff's
             const vogl_context_snapshot* pDiffContext = m_pBaseSnapshot->get_contexts()[c];
index 383a2b11955a9fc12e151d4570b3a6fa9fb69e32..bc5d4f3e8c2a60df98c8a6c40f6fd519212de32a 100644 (file)
@@ -196,7 +196,7 @@ bool vogleditor_traceReplayer::recursive_replay_apicallTreeItem(vogleditor_apiCa
         }
     }
 
-    if (bStatus && pItem->has_snapshot() && pItem->get_snapshot()->is_edited())
+    if (bStatus && pItem->has_snapshot() && pItem->get_snapshot()->is_edited() && pItem->get_snapshot()->is_valid())
     {
         bStatus = applying_snapshot_and_process_resize(pItem->get_snapshot()->get_snapshot());
     }