mirror of
https://github.com/ARMSX2/ARMSX3.git
synced 2026-08-24 16:58:52 -07:00
port_new opened with "if (g_started) return 1". That was defensible while gl1's state was whatever the previous saver left behind, but nativeInit now calls gl1_lost() before every create, so gl1 is guaranteed DOWN on entry. Reporting success there would hand the caller a saver with no shim under it. So the gl1_lost() added alongside the leak fix did not just close the leak, it turned that early return from redundant into wrong -- its safety rested on a call-graph property that same change removed. All six ports now tear down a stale run through port_free and always run gl1_init(). Each needs a forward declaration of port_free, which is defined below port_new. No behaviour change on any path reachable today: port_free always clears g_started, so the guard never fires. The point is that a saver added later, or an upstream cleanup that returns early, should fail in its own saver rather than poison the next one -- the same reason port_free tears gl1 down unconditionally. Adapted from the ARMSX2 change (be674a64c5).