]> git.cworth.org Git - vogl/blobdiff - src/vogleditor/vogleditor_tracereplayer.cpp
UI: separate capturing of vogl_gl_state_snapshot from allocation of the vogleditor_gl...
[vogl] / src / vogleditor / vogleditor_tracereplayer.cpp
index bc5d4f3e8c2a60df98c8a6c40f6fd519212de32a..c7d826bd4cc65661c5f6d7c0c03dc501bd6cc8f0 100644 (file)
@@ -173,15 +173,20 @@ bool vogleditor_traceReplayer::recursive_replay_apicallTreeItem(vogleditor_apiCa
                {
                   vogl_printf("Taking snapshot on API call # %" PRIu64 "\n", apiCallNumber);
 
-                  *ppNewSnapshot = vogl_new(vogleditor_gl_state_snapshot, m_pTraceReplayer->snapshot_state());
-
-                  if (*ppNewSnapshot == NULL)
+                  vogl_gl_state_snapshot* pNewSnapshot = m_pTraceReplayer->snapshot_state();
+                  if (pNewSnapshot == NULL)
                   {
-                     vogl_error_printf("Snapshot failed!\n");
+                      vogl_error_printf("Taking new snapshot failed!\n");
                   }
                   else
                   {
-                      vogl_printf("Snapshot succeeded\n");
+                      vogl_printf("Taking snapshot succeeded\n");
+                      *ppNewSnapshot = vogl_new(vogleditor_gl_state_snapshot, pNewSnapshot);
+                      if (*ppNewSnapshot == NULL)
+                      {
+                         vogl_error_printf("Allocating memory for snapshot container failed!\n");
+                         vogl_delete(pNewSnapshot);
+                      }
                   }
 
                   bStatus = false;