Global variables' values and checks on the "On start of layout" that will check "where" you are coming from, as explained in the already linked tutorial.
Same idea, same logic, only applied to your needs/program (in the tutorial is it a first execution ever, is it not; in your program is it the start of execution or not).
Also none of the links you linked to are an opened/currently investigated bug.
So if you have a case for a bug, do a proper report for it following the guidelines. Without proper opened reports, bugs won't get fixed.
Closed reports are not being investigated further. And necroing them does not help bringing attention to them either.