This task is performed by GreCloseScreenChangeArea (SCRAREA.C), as follows:
In a typical example, if we close the second SCA:
Memory loc. ------------------- pStartSCA = 250; | pscaNext = 200 | | | | 4th SCA | 0x250 ------------------- ------------------- | pscaNext = 150 | | | | 3th SCA | 0x200 ------------------- ------------------- | pscaNext = 100 | | | | 2nd SCA | 0x150 ------------------- ------------------- | pscaNext = 0 | | | | 1st SCA | 0x100 -------------------
we will get:
Memory loc. ------------------- pStartSCA = 250; | pscaNext = 200 | | | | 4th SCA | 0x250 ------------------- ------------------- | pscaNext = 100 | | | | 3th SCA | 0x200 ------------------- ------------------- | pscaNext = 0 | | | | 1st SCA | 0x100 -------------------
If the last remaining SCA is being freed, pStartSCA is set to NULL. If the latest SCA created is being freed, pStartSCA is set to the address of the SCA created immediately prior to it (the previous SCA).