Hi,
I expect that an event is never destroyed.
In Canvas.js this event is destroyed:
in EventHandler.js :
But in Canvas.js, this event is never destroyed:
So, the ListGrid remain attached thanks to _eventRegistry
Sample Code:
Each time you click on the button, you create a leak.
Leak in google DevTools:
Is-it a smartGwt Bug or shall i call a function to free _eventRegistry?
Thanks for your help.
Mike.
I expect that an event is never destroyed.
In Canvas.js this event is destroyed:
Code:
this._resizeID = isc.Page.setEvent(this._$resize, this, isc.Page.FIRE_ONCE);
Code:
canvasDestroyed : function (canvas) { .... if (canvas._resizeID) isc.Page.clearEvent(canvas._$resize, canvas._resizeID); ...
Code:
isc.Page.setEvent( "resize", this, isc.Page.FIRE_ONCE, "_relativePageResized" );
Sample Code:
Code:
private ListGrid lg = null; public static ListGridRecord createRecord(String name, String surname) { ListGridRecord record = new ListGridRecord(); record.setAttribute("Name", name); record.setAttribute("Surname", surname); return record; } public static ListGridRecord[] getRecords() { return new ListGridRecord[] { createRecord("Name1", "Surname1"), createRecord("Name2", "Surname2"), createRecord("Name3", "Surname3") }; } private ListGrid getListGrid() { final ListGrid grid = new ListGrid(); grid.setWidth(500); grid.setHeight(300); grid.setData(getRecords()); ListGridField nameField = new ListGridField("Name", "Name", 50); nameField.setCanEdit(true); ListGridField surnameField = new ListGridField("Surname", "Surname"); surnameField.setCanEdit(true); grid.setFields(nameField, surnameField); return grid; } @Override public void onModuleLoad() { final com.google.gwt.user.client.ui.VerticalPanel sp = new com.google.gwt.user.client.ui.VerticalPanel(); sp.setSize("100%", "100%"); com.google.gwt.user.client.ui.Button btn = new com.google.gwt.user.client.ui.Button("TEST"); sp.add(btn); btn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { sp.remove(lg); lg.destroy(); lg = getListGrid(); sp.add(lg); } }); lg = getListGrid(); sp.add(lg); RootPanel.get().add(sp); }
Leak in google DevTools:
Is-it a smartGwt Bug or shall i call a function to free _eventRegistry?
Thanks for your help.
Mike.
Comment