Bug 248389 - Please fix a dispose method of Grid.
Summary: Please fix a dispose method of Grid.
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Nebula (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P1 normal (vote)
Target Milestone: ---   Edit
Assignee: Mirko Paturzo CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-24 03:07 EDT by Soichiro Yoshimura CLA
Modified: 2021-07-05 11:40 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Soichiro Yoshimura CLA 2008-09-24 03:07:02 EDT
Build ID: I20080617-2000

Steps To Reproduce:
Grid have a number of not garbage collected fields caused by crossreferences.

Please fix onDispose method of Grid.

Grid line:6138
:::::FROM:::::

  private void onDispose(Event event)
    {   
        //We only want to dispose of our items and such *after* anybody else who may have been 
        //listening to the dispose has had a chance to do whatever.
        removeListener(SWT.Dispose, disposeListener);
        notifyListeners(SWT.Dispose, event);
        event.type = SWT.None;
        
        disposing = true;
        
        cellHeaderSelectionBackground.dispose();

        for (Iterator iterator = items.iterator(); iterator.hasNext();)
        {
            GridItem item = (GridItem)iterator.next();
            item.dispose();
        }
        
        for (int i = 0; i < columnGroups.length; i++)
        {
            columnGroups[i].dispose();
        }
        
        for (Iterator iterator = columns.iterator(); iterator.hasNext();)
        {
            GridColumn col = (GridColumn)iterator.next();
            col.dispose();
        }
        
        sizingGC.dispose();
    }

:::::TO:::::
 private void onDispose(Event event)
    {   
        //We only want to dispose of our items and such *after* anybody else who may have been 
        //listening to the dispose has had a chance to do whatever.
        removeListener(SWT.Dispose, disposeListener);
        notifyListeners(SWT.Dispose, event);
        event.type = SWT.None;
        
        disposing = true;
        
        cellHeaderSelectionBackground.dispose();

        if(items != null)
        {
	        for (Iterator iterator = items.iterator(); iterator.hasNext();)
	        {
	            GridItem item = (GridItem)iterator.next();
	            item.dispose();
	        }
	        
	        items.clear();
	        items = null;
	        
	        selectedItems.clear();
	        selectedItems = null;
	        
	        rootItems.clear();
	        rootItems = null;
        }
        
        if(columnGroups != null)
        {
	        for (int i = 0; i < columnGroups.length; i++)
	        {
	            columnGroups[i].dispose();
	        }
	        
	        columnGroups = null;
        }
        
        if(columns != null)
        {
	        for (Iterator iterator = columns.iterator(); iterator.hasNext();)
	        {
	            GridColumn col = (GridColumn)iterator.next();
	            col.dispose();
	        }
	        
	        columns.clear();
	        columns = null;
	        
	        selectedColumns.clear();
	        selectedColumns = null;
        }
        
        if(selectedCells != null)
        {
	        selectedCells.clear();
	        selectedCells = null;
        }
        
        if(selectedCellsBeforeRangeSelect != null)
        {
	        selectedCellsBeforeRangeSelect.clear();
	        selectedCellsBeforeRangeSelect = null;
        }
        
        if(sizingGC != null)
        {
        	sizingGC.dispose();
        	sizingGC = null;
        }
        
        if(displayOrderedColumns != null)
        {
	        displayOrderedColumns.clear();
	        displayOrderedColumns = null;
        }
        
        if(emptyCellRenderer != null)
        {
        	emptyCellRenderer.setDisplay(null);
        	emptyCellRenderer = null;
        }
        
        if(emptyColumnHeaderRenderer != null)
        {
        	emptyColumnHeaderRenderer.setDisplay(null);
        	emptyColumnHeaderRenderer = null;
        }
        
        if(emptyRowHeaderRenderer != null)
        {
        	emptyRowHeaderRenderer.setDisplay(null);
        	emptyRowHeaderRenderer = null;
        }
        
        if(rowHeaderRenderer != null)
        {
        	rowHeaderRenderer.setDisplay(null);
        	rowHeaderRenderer = null;
        }
        
        if(topLeftRenderer != null)
        {
        	topLeftRenderer.setDisplay(null);
        	topLeftRenderer = null;
        }
    }

More information:
Comment 1 Thomas Schindl CLA 2009-03-04 10:45:30 EST
Could you please create a patch against header_footer branch so that I can keep our IP-Log clean the I'll commit it to CVS
Comment 2 Thomas Schindl CLA 2009-04-24 09:58:31 EDT
Please provide a patch against HEAD
Comment 4 Mirko Paturzo CLA 2014-02-10 08:08:07 EST
Improve dispose performace and create a snippet test.
Comment 5 Mirko Paturzo CLA 2014-02-10 10:43:49 EST
Test done and bug fixed