X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=context.c;h=764e159f25cc9989722160bfc4cc6419d58bf979;hb=07bf218026f6921c0b62714df9ec441b24884537;hp=b18017da9b55b5d8d345e9399c5af5728a948df3;hpb=6bfaad321892191c4e429fe302a819dff92cdca6;p=fips diff --git a/context.c b/context.c index b18017d..764e159 100644 --- 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