Odd behaviour with my extension when switching to SetList mode

I am getting some odd behaviour when switching to SetList mode via the standard UI where GP hangs and maxes out the CPU on a single core (I’m assuming some kind of infinite loop). Seemingly the presence of my extension is causing an issue. I’m doing barely anything upon a switch to SetList mode. Extract from LibMain.h:

    void OnModeChanged(int mode) override
        writeToLog("Switching Mode");

     void static writeToLog(std::string msg)
        std::ofstream outfile;
        outfile.open("C:/Users/Public/Documents/Gig Performer/Extensions/log.txt", std::ios::app);
        outfile << msg << std::endl;

I do notice, however, that I am including the v44 SDK from GitHub in the compile process in CMakeLists.txt:

# Import the SDK
  GIT_REPOSITORY https://github.com/gigperformer/gp-sdk.git
  GIT_TAG 6c5432518ef42ea0870fb44597e9d1d3780e2f98 # v44

I am running this against Deskew (i.e. not PluginAlliance) GP4 v4.5.8. Should the versioning be in sync? Could this be causing me an issue? I can’t find any later SDK releases available on GitHub.

It may be relevant, when I have a bank gig file and switch to an empty SetList, GP4 doesn’t hang.

This is very odd. After commenting out various bits of code the problem persists. So, in frustration, I deleted my extension from the Extensions folder and ran GP4 again. This time my extension is not loaded, as expected, but the same problem of hanging upon switching to SetList mode persists. It seems I may need to do a complete reinstall of GP4 as something somewhere had gone awry.