The change keeping `outer_window` pointer alive for longer affects tens of NULL checks that we have in the code. Did you actually review the impact? It seems to me that a number of those checks are less correct after the change. I really think it needs closer look and probably some refactoring first so that the change has less impact. I'd suggest dropping all but first two patches for now.