Grid destructor error

Hi,
Closing tabbar page I’m releasing objects from memory . Source :

         mainTab.attachEvent( "onTabClose", function( id )
         {
            var tabr = mainTab.cells( id ).getView().tabbar;
            if ( tabr != null ) 
            {
               var arr = tabr.getAllTabs();
               for ( var u = arr.length - 1; u = 0; u -- )
               {
                  var grd = tabr.cells( arr[ u ] ).getView().grid;
                  var tlb = tabr.cells( arr[ u ] ).getView().toolbar;
                  if ( tlb != null )
                  {
                     tlb.unload();
                     tlb = null;
                  }
                  if ( grd != null )
                  {
                     grd.destructor();
                     grd = null;
                  }
               }
               tabr.clearAll();
               tabr = null;
            }
            var grid = mainTab.cells( id ).getView().grid;
            if ( grid != null )
            {
               debugger;
               grid.clearAll( true );
               grid.destructor();
               grid = null;
            }
            var tlbr = mainTab.cells( id ).getView().toolbar;
            if ( tlbr != null )
            {
               tlbr.clearAll();
               tlbr = null;
            }
            return true;
         });         

It return error from dhtmlx.js 562 line : if (this.vs[this.av].grid){this.vs[this.av].grid.setSizes();}
Error : Uncaught TypeError: Property ‘setSizes’ of object # is not a function

As you can see in code , Chrome JS console debugger stops , I can see that grid object become null ( 1 png image ) . But in the 2 image , you can see that grid object is not nulled and it return error . How to fix that ?
Also I want to notice , that other tab pages can get tabbars . Then release inside other tabbar of toolbars and grids works fine, without problems . It falls only in the main tabbar …



Problem solved … :slight_smile: . At first I tried only with grid.destructor() - it returned error as described . Then added clearAll( true ) . The same erorr … Now I leaved only grid.clearAll( true ) . Work fine now … :smiley:

It seems that I make hasted … :frowning: clearAll( true ) don’t clear up memory from grid object . So I must to use destructor in that place . But destructor() return error . The question is the open and the same : how to solve that problem ?

Unfortunately the issue cannot be reconstructed locally.
Please, provide a complete demo where the issue can be reproduced.
Here you can find a tutorial:
docs.dhtmlx.com/doku.php?id=othe … leted_demo