Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 517403

Summary: [e4] JS error occurs when close view
Product: [RT] RAP Reporter: Dorota Oli <dorocia0152>
Component: OtherAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ivan
Version: 3.1   
Target Milestone: 3.3 M1   
Hardware: PC   
OS: Windows 10   
See Also: https://git.eclipse.org/r/#/c/99378/
Whiteboard:
Attachments:
Description Flags
Close view crash application
none
patch to ogr.eclipse.e4.demo to reproduce bug none

Description Dorota Oli CLA 2017-05-29 15:40:32 EDT
Error occurs when
-> minimize my view
->click on his icon
-> view open in "preview mode"
-> close view

Destroy is called twice.

Error: Error: Operation "destroy" on target "w75" of type "null" failed:
Cannot read property 'handler' of undefined
Properties: 


  Script: {"head":{},"operations":[["destroy","w305"],["destroy","w300"],["destroy","w303"],["destroy","w304"],["destroy","w75"],["destroy","w298"],["set","w24",{"activeControl":"w33","children":["w25","w155"]}],["set","w25",{"bounds":[0,58,844,604],"clientArea":[0,0,844,604]}],["set","w26",{"bounds":[0,0,844,604],"clientArea":[0,0,844,604]}],["set","w27",{"bounds":[0,0,844,604],"clientArea":[0,0,844,604]}],["set","w28",{"children":["w29","w50","w59","w90","w126","w161","w162","w309","w310"],"bounds":[0,0,844,604],"clientArea":[0,0,844,604]}],["set","w29",{"bounds":[0,0,168,300],"tabIndex":5,"minimizeBounds":[129,5,18,18],"maximizeBounds":[147,5,18,18]}],["set","w30",{"bounds":[-35,1,163,28]}],["set","w46",{"tabIndex":7}],["set","w49",{"tabIndex":10}],["set","w31",{"tabIndex":11}],["set","w33",{"bounds":[3,32,162,265],"tabIndex":12,"clientArea":[0,0,162,265]}],["set","w34",{"bounds":[0,0,162,265],"clientArea":[0,0,162,265]}],["set","w35",{"tabIndex":14}],["set","w36",{"tabIndex":15}],["set","w39",{"tabIndex":16}],["set","w42",{"tabIndex":17}],["set","w43",{"tabIndex":18}],["set","w50",{"bounds":[0,304,168,300],"tabIndex":19,"minimizeBounds":[129,5,18,18],"maximizeBounds":[147,5,18,18]}],["set","w175",{"bounds":[0,0,91,29]}],["set","w51",{"bounds":[96,1,32,28]}],["set","w57",{"tabIndex":21}],["set","w52",{"tabIndex":22}],["set","w54",{"bounds":[3,32,162,265],"tabIndex":23,"clientArea":[0,0,162,265]}],["set","w55",{"bounds":[0,0,162,265],"clientArea":[0,0,162,265]}],["set","w56",{"bounds":[0,0,162,265],"tabIndex":25}],["set","w59",{"bounds":[172,0,334,604],"tabIndex":26,"minimizeBounds":[295,5,18,18],"maximizeBounds":[313,5,18,18]}],["set","w60",{"bounds":[-155,1,449,28]}],["set","w66",{"tabIndex":28}],["set","w69",{"tabIndex":31}],["set","w70",{"tabIndex":32}],["set","w74",{"tabIndex":35}],["set","w61",{"tabIndex":36}],["set","w63",{"bounds":[3,32,328,569],"tabIndex":37,"clientArea":[0,0,328,569]}],["set","w64",{"bounds":[0,0,328,569],"tabIndex":38,"clientArea":[0,0,328,569]}],["set","w90",{"bounds":[510,0,334,300],"tabIndex":39,"minimizeBounds":[295,5,18,18],"maximizeBounds":[313,5,18,18]}],["set","w91",{"bounds":[-40,1,334,28]}],["set","w116",{"tabIndex":41}],["set","w92",{"tabIndex":42}],["set","w94",{"bounds":[3,32,328,265],"tabIndex":43,"clientArea":[0,0,328,265]}],["set","w95",{"bounds":[0,0,328,265],"clientArea":[0,0,328,265]}],["set","w98",{"tabIndex":47}],["set","w99",{"tabIndex":48}],["set","w105",{"tabIndex":49}],["set","w106",{"tabIndex":50}],["set","w109",{"bounds":[0,0,328,265],"tabIndex":51,"clientArea":[0,0,328,265]}],["set","w113",{"tabIndex":54}],["set","w115",{"tabIndex":56}],["set","w126",{"bounds":[510,304,334,300],"tabIndex":57,"minimizeBounds":[295,5,18,18],"maximizeBounds":[313,5,18,18]}],["set","w127",{"bounds":[146,1,148,28]}],["set","w147",{"tabIndex":59}],["set","w128",{"tabIndex":60}],["set","w130",{"bounds":[3,32,328,265],"tabIndex":61,"clientArea":[0,0,328,265]}],["set","w131",{"bounds":[0,0,328,265],"clientArea":[0,0,328,265]}],["set","w134",{"tabIndex":65}],["set","w135",{"tabIndex":66}],["set","w141",{"tabIndex":67}],["set","w142",{"tabIndex":68}],["set","w145",{"bounds":[0,0,328,265],"tabIndex":69,"clientArea":[0,0,328,265]}],["set","w161",{"bounds":[0,300,168,4]}],["set","w162",{"bounds":[168,0,4,604]}],["create","w309","rwt.widgets.Sash",{"parent":"w28","style":["VERTICAL"],"bounds":[506,0,4,604],"tabIndex":-1}],["listen","w309",{"Selection":true}],["create","w310","rwt.widgets.Sash",{"parent":"w28","style":["HORIZONTAL"],"bounds":[510,300,334,4],"tabIndex":-1}],["listen","w310",{"Selection":true}],["set","w157",{"tabIndex":72}],["set","w1",{"focusControl":"w33"}]]}
  Stack: Error: Operation "destroy" on target "w75" of type "null" failed:
Cannot read property 'handler' of undefined
Properties: 

    at Object._processError (http://127.0.0.1:10511/rwt-resources/312/rap-client.js:62003:11)
    at Object.processOperationArray (http://127.0.0.1:10511/rwt-resources/312/rap-client.js:61844:12)
    at Object.processMessage (http://127.0.0.1:10511/rwt-resources/312/rap-client.js:61796:12)
    at Object._handleSuccess (http://127.0.0.1:10511/rwt-resources/312/rap-client.js:62480:19)
    at rwt.remote.Request._success (http://127.0.0.1:10511/rwt-resources/312/rap-client.js:31409:41)
    at rwt.remote.Request._onReadyStateChange (http://127.0.0.1:10511/rwt-resources/312/rap-client.js:31446:16)
    at XMLHttpRequest. (http://127.0.0.1:10511/rwt-resources/312/rap-client.js:624:17)
Comment 1 Ivan Furnadjiev CLA 2017-05-30 02:48:33 EDT
Please provide a snippet to reproduce the issue. I can't say anything based on the error above.
Comment 2 Dorota Oli CLA 2017-05-30 16:23:00 EDT
Created attachment 268644 [details]
Close view crash application
Comment 3 Dorota Oli CLA 2017-05-30 16:24:30 EDT
I can't localize a source of bug. Problem is when is called this function. Destroy is called for parent and his children, next is called for child that was destroyed and objectEntry is undefined.


_processDestroy : function( targetId ) {
    var objectEntry = rwt.remote.ObjectRegistry.getEntry( targetId );
    var handler = objectEntry.handler;
    var targetObject = objectEntry.object;
    var children =   handler.getDestroyableChildren
                   ? handler.getDestroyableChildren( targetObject )
                   : null;
    if( handler.destructor instanceof Function ) {
      handler.destructor( targetObject );
    } else if( typeof handler.destructor === "string" ) {
      var destructorName = handler.destructor;
      targetObject[ destructorName ]();
    }
    rwt.remote.ObjectRegistry.remove( targetId );
    rwt.remote.RemoteObjectFactory.remove( targetId );
    for( var i = 0; children != null && i < children.length; i++ ) {
      if( children[ i ] ) {
        this._processDestroy( rwt.remote.ObjectRegistry.getId( children[ i ] ) );
      }
    }
  },
Comment 4 Dorota Oli CLA 2017-05-30 16:24:49 EDT
I can't localize a source of bug. Problem is when is called this function. Destroy is called for parent and his children, next is called for child that was destroyed and objectEntry is undefined.


_processDestroy : function( targetId ) {
    var objectEntry = rwt.remote.ObjectRegistry.getEntry( targetId );
    var handler = objectEntry.handler;
    var targetObject = objectEntry.object;
    var children =   handler.getDestroyableChildren
                   ? handler.getDestroyableChildren( targetObject )
                   : null;
    if( handler.destructor instanceof Function ) {
      handler.destructor( targetObject );
    } else if( typeof handler.destructor === "string" ) {
      var destructorName = handler.destructor;
      targetObject[ destructorName ]();
    }
    rwt.remote.ObjectRegistry.remove( targetId );
    rwt.remote.RemoteObjectFactory.remove( targetId );
    for( var i = 0; children != null && i < children.length; i++ ) {
      if( children[ i ] ) {
        this._processDestroy( rwt.remote.ObjectRegistry.getId( children[ i ] ) );
      }
    }
  },
Comment 5 Ivan Furnadjiev CLA 2017-05-31 03:41:36 EDT
Please try with RAP 3.2 M7. I'm positive that this issue is already fixed there.
Comment 6 Dorota Oli CLA 2017-05-31 15:25:33 EDT
(In reply to Ivan Furnadjiev from comment #5)
> Please try with RAP 3.2 M7. I'm positive that this issue is already fixed
> there.

I try, but still the same result.
Comment 7 Ivan Furnadjiev CLA 2017-06-01 02:35:09 EDT
The screenshot is from our e4 demo... did you modify something in order to reproduce the crash? Please give me the exact steps for the e4 demo (including a patch) in order to reproduce the crash.
Comment 8 Dorota Oli CLA 2017-06-01 03:28:48 EDT
I only change part to closable to be able to reproduce this bug.
Comment 9 Ivan Furnadjiev CLA 2017-06-01 04:08:30 EDT
Please create a patch against e4 Demo with your changes and attach it here.
Comment 10 Dorota Oli CLA 2017-06-01 04:45:22 EDT
Created attachment 268694 [details]
patch to ogr.eclipse.e4.demo to reproduce bug
Comment 11 Dorota Oli CLA 2017-06-06 09:09:08 EDT
Did you reproduce this bug?
Comment 12 Ivan Furnadjiev CLA 2017-06-06 09:48:58 EDT
Sorry, I'm very busy these days and didn't have time to check and reproduce it.
Comment 13 Ivan Furnadjiev CLA 2017-06-14 06:08:45 EDT
OK... finally I found time to give it a try... and can reproduce the crash with your patch.