mirror of https://github.com/rusefi/RomRaider.git
Fixed error table closing issue
This commit is contained in:
parent
425c8e01d9
commit
11b5913787
|
@ -74,6 +74,7 @@ import org.xml.sax.SAXParseException;
|
|||
import com.romraider.Settings;
|
||||
import com.romraider.logger.ecu.EcuLogger;
|
||||
import com.romraider.maps.Rom;
|
||||
import com.romraider.maps.Table;
|
||||
import com.romraider.maps.Table1D;
|
||||
import com.romraider.maps.Table1DView;
|
||||
import com.romraider.maps.Table2D;
|
||||
|
@ -385,27 +386,30 @@ public class ECUEditor extends AbstractFrame {
|
|||
|
||||
if(frame == null) {
|
||||
TableView v;
|
||||
Table t = node.getTable();
|
||||
|
||||
if(node.getTable() instanceof TableSwitch)
|
||||
v = new TableSwitchView((TableSwitch)node.getTable());
|
||||
else if(node.getTable() instanceof TableBitwiseSwitch)
|
||||
v = new TableBitwiseSwitchView((TableBitwiseSwitch)node.getTable());
|
||||
else if(node.getTable() instanceof Table1D)
|
||||
v = new Table1DView((Table1D)node.getTable());
|
||||
else if(node.getTable() instanceof Table2D)
|
||||
v = new Table2DView((Table2D)node.getTable());
|
||||
else if(node.getTable() instanceof Table3D)
|
||||
v = new Table3DView((Table3D)node.getTable());
|
||||
else
|
||||
return;
|
||||
|
||||
Rom rom = RomTree.getRomNode(node);
|
||||
frame = new TableFrame(node.getTable().getName() + " | " + rom.getFileName(), v);
|
||||
}
|
||||
|
||||
// frame not added. Draw table and add the frame.
|
||||
frame.getTable().getTableView().drawTable();
|
||||
rightPanel.add(frame);
|
||||
if (t!=null) {
|
||||
if(t instanceof TableSwitch)
|
||||
v = new TableSwitchView((TableSwitch)t);
|
||||
else if(t instanceof TableBitwiseSwitch)
|
||||
v = new TableBitwiseSwitchView((TableBitwiseSwitch)t);
|
||||
else if(t instanceof Table1D)
|
||||
v = new Table1DView((Table1D)t);
|
||||
else if(t instanceof Table2D)
|
||||
v = new Table2DView((Table2D)t);
|
||||
else if(t instanceof Table3D)
|
||||
v = new Table3DView((Table3D)t);
|
||||
else
|
||||
return;
|
||||
|
||||
Rom rom = RomTree.getRomNode(node);
|
||||
frame = new TableFrame(node.getTable().getName() + " | " + rom.getFileName(), v);
|
||||
|
||||
// frame not added. Draw table and add the frame.
|
||||
frame.getTableView().drawTable();
|
||||
rightPanel.add(frame);
|
||||
}
|
||||
}
|
||||
} catch (IllegalArgumentException ex) {
|
||||
;// Do nothing.
|
||||
}
|
||||
|
@ -427,7 +431,6 @@ public class ECUEditor extends AbstractFrame {
|
|||
ECUEditor editor = ECUEditorManager.getECUEditor();
|
||||
RomTreeRootNode imageRoot = editor.getImageRoot();
|
||||
|
||||
rom.clearData();
|
||||
rom.removeFromParent();
|
||||
|
||||
if (imageRoot.getChildCount() > 0) {
|
||||
|
@ -440,6 +443,8 @@ public class ECUEditor extends AbstractFrame {
|
|||
editor.getStatusPanel().setStatus(ECUEditor.rb.getString("STATUSREADY"));
|
||||
editor.setCursor(null);
|
||||
editor.refreshUI();
|
||||
|
||||
rom.clearData();
|
||||
System.gc();
|
||||
}
|
||||
|
||||
|
|
|
@ -118,16 +118,17 @@ public abstract class Table implements Serializable {
|
|||
|
||||
//Cleans up all references to avoid data leaks
|
||||
public void clearData() {
|
||||
|
||||
for(int i=0;i<getDataSize();i++) {
|
||||
if(data[i]!=null) {
|
||||
data[i].setTable(null);
|
||||
data[i].setRom(null);
|
||||
data[i] = null;
|
||||
}
|
||||
if(data != null) {
|
||||
for(int i=0;i<getDataSize();i++) {
|
||||
if(data[i]!=null) {
|
||||
data[i].setTable(null);
|
||||
data[i].setRom(null);
|
||||
data[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
data = null;
|
||||
}
|
||||
|
||||
data = null;
|
||||
}
|
||||
|
||||
public void setData(DataCell[] data) {
|
||||
|
|
|
@ -82,7 +82,8 @@ public class Table2DView extends TableView {
|
|||
|
||||
// add to table
|
||||
for (int i = 0; i < axis.getTable().getDataSize(); i++) {
|
||||
centerPanel.add(axis.getDataCell(i));
|
||||
DataCellView v = axis.getDataCell(i);
|
||||
if(v != null)centerPanel.add(v);
|
||||
}
|
||||
|
||||
if (table.flip) {
|
||||
|
|
|
@ -579,11 +579,14 @@ public abstract class TableView extends JPanel implements Serializable {
|
|||
//Populate Views from table here
|
||||
if(getTable().presetManager != null) addPresetPanel(getTable().presetManager);
|
||||
|
||||
if(!isHidden()) {
|
||||
if(!isHidden() && table.getData() != null) {
|
||||
data = new DataCellView[table.getDataSize()];
|
||||
|
||||
for(int i= 0; i < table.getDataSize(); i++) {
|
||||
data[i] = new DataCellView(table.getData()[i], this);
|
||||
DataCell c = table.getData()[i];
|
||||
if (c!=null) {
|
||||
data[i] = new DataCellView(c, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,6 +114,8 @@ public class TableFrame extends JInternalFrame implements InternalFrameListener,
|
|||
}
|
||||
|
||||
public Table getTable() {
|
||||
if(tableView == null) return null;
|
||||
|
||||
return tableView.getTable();
|
||||
}
|
||||
public TableView getTableView() {
|
||||
|
|
|
@ -315,7 +315,7 @@ public class TableToolBar extends JToolBar implements MouseListener, ItemListene
|
|||
Table t = getTable();
|
||||
|
||||
if(t != null)
|
||||
this.updateTableToolBar(getTable());
|
||||
this.updateTableToolBar(t);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue