chiark / gitweb /
Call game_id_change_notify_function after deserialisation.
authorSimon Tatham <anakin@pobox.com>
Thu, 14 Sep 2017 18:06:44 +0000 (19:06 +0100)
committerSimon Tatham <anakin@pobox.com>
Thu, 14 Sep 2017 18:06:44 +0000 (19:06 +0100)
That's a case in which the current game IDs have changed, so the
midend ought to be calling the front-end function (if any) that
notifies it when that happens.

The only front end of mine that was affected by this missing call was
the Javascript one, which uses that callback to update the 'Link to
this puzzle' links below the game canvas - but, of course, that front
end didn't ever call midend_deserialise until this month, so no wonder
I never noticed before.

(But downstream front ends might be affected too, for all I know.)

midend.c

index 2eb5ee93e8f3b00667ad3af84f51a8a2e6e3dd22..3059d6b81ea95c3f8020bd5a54919c0f0721849a 100644 (file)
--- a/midend.c
+++ b/midend.c
@@ -2059,6 +2059,8 @@ char *midend_deserialise(midend *me,
         me->ourgame->new_drawstate(me->drawing,
                                   me->states[me->statepos-1].state);
     midend_size_new_drawstate(me);
+    if (me->game_id_change_notify_function)
+        me->game_id_change_notify_function(me->game_id_change_notify_ctx);
 
     ret = NULL;                        /* success! */