View Full Version : [CLOSED] Destroying all windows makes breaks MessageBox

10 Nov 2010, 4:26 AM
In one of our projects we use quite a few windows for dialog, information and such. The project is based on Exts's documentation, so there are a lot of pages with different information and different windows being loaded all the time.

We made a small "hack" of sorts that look like this:

- A user clicks a link within a project
- We destroy all leftover windows
- We load a new page (which may in turn load new windows etc.)

This looks easy enough:

Ext.WindowMgr.each(function(w) {

However... We hit a bug with Ext.MessageBoxes. Looks like follows. Easily reproduced with firebug:

>> a = Ext.MessageBox.wait()

>> a.hide()

>> Ext.WindowMgr.each(function(w) { w.close(); w.destroy(); });

>> a = Ext.MessageBox.wait()
TypeError: Result of expression 'this.dom' [undefined] is not an object.

>> a.hide()

Clearly the MessageBox singleton doesn't check whether its windows have been destroyed (an under normal circumstances it really shouldn't).

However, I believe that either the messagebox shoudln't regster itself with the Ext.windowMgr or should set some sort of a "x-special: true" flag we can check to see if the window can be destroyed or not.

10 Nov 2010, 4:56 AM
Ext.MessageBox doesn't expect it's window to be destroyed.

I would recommend creating a different WindowGroup for you own windows, so you can only close the windows in that group.