Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Error raised when fireing an event on already destroyed component

    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-22909 in 6.5.2.
  1. #1
    Sencha Premium Member
    Join Date
    Oct 2015
    Posts
    22

    Default Error raised when fireing an event on already destroyed component

    Ext version tested:


    • Ext 6.0.1 rev 981 (still works, but event is fired on destroyed component)
    • Ext 6.2.1 rev 167 (software breaks because exception is fired)


    Description:

    • Global events are fired on components that are already destroyed and an exception ist fired: Uncaught Error: Attempting to fire "name" event on destroyed component
    • this breaks our software because in previous versions no error was fired
    • In 6.2 code was added to Ext.util.Event that fires an exception if the component is already destroyed

    Code:
    // If the scope is already destroyed, we absolutely cannot deliver events to it. // We also need to clean up the listener to avoid it hanging around forever 
    // like a zombie. Scope can be null/undefined, that's normal. 
                    if (fireScope && fireScope.destroyed) {
    //<debug> 
    // DON'T raise errors if the destroyed scope is an Ext.container.Monitor! 
    // It is to be deprecated and removed shortly. 
                        if (fireScope.$className !== 'Ext.container.Monitor') {
                            Ext.raise({
                                msg: 'Attempting to fire "' + me.name + '" event on destroyed ' +
                                      (fireScope.$className || 'object') + ' instance with id: ' +
                                      (fireScope.id || 'unknown'),
                                instance: fireScope
                            });
                        }
    //</debug> 
                        
                        me.removeListener(fireFn, fireScope, i);
                        
                        fireFn = null;
                    }
    Steps to reproduce the problem:


    • The problem occurres if two components listen to the same event and component 1 contains component 2 and removes all its children when the event is fired, component 2 is still in the arrays of listeners because the listeners array was saved before into a local variable and still contains component 2 even so this component removed itself as a listener in its destroy method.
    • Click on 'Test' in the fiddle to reproduce the problem


    The result that was expected:


    • The event should not be executed on destroyed components but no error should be fired either. It should not be a problem to not fire an error, if the component has already been destroyed.


    The result that occurs instead:


    • an error is fired if a component is already destroyed


    Maybe we just don't know how to really handle events and destroy components and we should do differently but before updating the version it seemed to work as expected.


  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985

    Default

    Thanks for the report. We're tracking this issue as EXTJS-22909. It's still unresolved at this time.

  3. #3
    Sencha Premium Member
    Join Date
    Oct 2015
    Posts
    22

    Default

    Is there any workaround? It seems as if our software is too complex so changing our code is not possible (we already tried in one class).
    We tried to override the Ext.util.Event but unfortunately we don't know how to override a class with create function. Can you please tell us how to override this class.

  4. #4
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985

    Default

    There is a workaround noted on the bug ticket -- apologies for not seeing it earlier. As a Support subscriber, you can open a ticket to gain access. Hopefully it will correct the issue for you. Either way, your credits will be refunded since it's a bug.

  5. #5
    Sencha Premium Member
    Join Date
    Feb 2013
    Posts
    12

    Default

    Could you post the workaround here, please?

  6. #6
    Sencha Premium Member
    Join Date
    Oct 2015
    Posts
    22

    Default

    The suggestion was to defer the closing of the component.

    Code:
    listeners: {
        select: function() {
            var me = this;
            Ext.asap(function() {
                me.close();  
            });
        }
    }
    This didn't help us, the error still occurred at lot of times. Unfortunately we had to override the Event class uncommenting the code and couldn't find any other solution. But this is not a good workaround.

  7. #7
    Sencha Premium Member
    Join Date
    Feb 2013
    Posts
    12

    Default

    Thanks for your post!

    This workaround didn't help in our case either. Currently calling close() later as a workaround.

  8. #8
    Sencha Premium Member
    Join Date
    Nov 2013
    Posts
    160

    Default

    Is there any progress on this? What would happen if you were to just ignore the error? Are there possible side effects?

  9. #9
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985

    Default

    According to the ticket, this issue was fixed last month for 6.2.2 and 6.5.2.

  10. #10
    Sencha Premium Member
    Join Date
    Nov 2013
    Posts
    160

    Default

    How do I get 6.5.2? Is this an official release that I can use in production?

Page 1 of 2 12 LastLast

Similar Threads

  1. Problem with event fireing
    By noway in forum Ext 5: Q&A
    Replies: 3
    Last Post: 5 May 2014, 10:13 AM
  2. Replies: 0
    Last Post: 4 Nov 2009, 4:15 PM
  3. Replies: 8
    Last Post: 8 Jul 2008, 12:51 AM
  4. Event Raised For Connection Timeout
    By herrjj in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 2 Jul 2008, 8:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •