Disposed window problem while the window is clearly NOT disposed

I'm programming a glossary system that sorts characters by stats.
There is a menu to choose a character, then a page for each character.

1661115911815.png

The menu

1661115942599.png

The characters page.

And when I get to a character's page and want to press return, the game uses a command that disposes of the windows on the character's page to return to the menu, and then rpg maker shows me a disposed window error, while the window is clearly NOT disposed yet.

1661115991189.png


I can tell because to switch from one character to the next without going back to the menu, I use the exact same command that disposes the windows, and it works without giving me this error.
I checked with my command that returns to the menu, it is indeed the command that disposes of the windows that has a problem.

I tried it on a blank project, it returns the same error, so it's not coming from another script.
I just can't figure out why it refuses to dispose my window, and it's driving me crazy.

I need help.

Don't worry about the missing graphics, I added a script to ignore them, it's just so you can see the problems and the script.
The command that dispose of the windows is at the end of the script.
That sounds as if you got a reference wrong.

error messages can't lie, but they can be misinterpreted.
If the error message is about a disposed window, then the command or function it tried to do points to a disposed window. And if the Window you believe it points to still exists, then that means that the code referenced a different window than the one you assume it does.

However I have a suggestion to improve your error messages:
please follow the link on how to use a script in my signature, go to the bughunting section there and install the backtracer script mentioned there. That will print the full error trace to the console, making bughunting much easier for you.
eyeballing it here:
-this window.
-keypress on this window.
-dispose this window.
-update this window -> update upper window.
-can't update, window disposed, because *this* window disposed.

I think that's what's happening: the window shouldn't be disposed at any time.
one has to properly close and release it before disposing it.
"disposing" of, you just dispose of when the scene is no longer active.
if the scene is still active, you don't "dispose" of windows, you just hide them out of sight.
that's why no error is thrown when the scene is active on the main list, and not the character.
the character window is still there, hidden, and still updating.
it's only when you dispose of it, that it throws an error.

Original thread: https://forums.rpgmakerweb.com/threads/disposed-window-problem-while-the-window-is-clearly-not-disposed.150688/