]> git.cworth.org Git - fips/blobdiff - context.c
stash
[fips] / context.c
index b18017da9b55b5d8d345e9399c5af5728a948df3..764e159f25cc9989722160bfc4cc6419d58bf979 100644 (file)
--- a/context.c
+++ b/context.c
@@ -68,6 +68,14 @@ context_destroy (context_t *ctx)
 void
 context_enter (fips_api_t api, void *system_context_id)
 {
+       /* Do nothing for a NULL system_context_id. (Don't ask me why,
+        * but Dota 2 likes to call MakeCurrent with a NULL context ID
+        * just before calling MakeCurrent with the same context it
+        * had been using before. We want to do nothing in this case.)
+        */
+       if (system_context_id == NULL)
+               return;
+
        /* Do nothing if the application is setting the same context
         * as is already current. */
        if (current_context && current_context->system_id == system_context_id)
@@ -91,7 +99,7 @@ context_leave (void)
        if (ctx == NULL)
                return;
 
-       metrics_destroy (ctx->metrics);
+       metrics_fini (ctx->metrics);
 }
 
 void