Question / Help Display capture not working after exiting the game

Under sources I have game capture followed by display capture.

It records my desktop normally before launching the game (csgo in my example). Then it records the game. But when I exit the game, it doesn't switch back to recording the desktop. It instead records the last frame that the game had been showing before exiting. Same happens with alt-tabbing.

This same setup worked correctly until I bought a new monitor and enabled gsync. Not sure if gsync is causing this behavior.

I know that switching the game to borderless would work, but I'd rather not do that since gsync doesn't work as good unless it's full screen.
This can't really be fixed, it's expected behavior. If you've piled two sources one on top of each other in the same scene, with the game source on top, then this sort of works going from desktop to game, as the inactive game source doesn't obscure your desktop while the game isn't running.

But when the game stops running, the game capture source is going to hold the last frame, which is probably going to be a black screen. That's going to obscure your desktop capture.

You can either use hotkeys to hide/show your two sources, or better yet, use a separate scene for game and desktop capture-- it is NOT recommended to have both in the same scene, partially for reasons of performance, and partially because of problems like the one you are experiencing. It would be better to have those captures in different scenes and switch scenes with a hotkey.