From 01275897b725981c73ac7a2ca9d1aadfeb6fe7c1 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Sun, 16 Sep 2007 08:45:35 +0000 Subject: [PATCH] * [ 1795685 ] Don't populate readonly lookup --- client/src/org/compiere/grid/ed/VLookup.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/client/src/org/compiere/grid/ed/VLookup.java b/client/src/org/compiere/grid/ed/VLookup.java index 3f4ee657a2..f352033cb3 100644 --- a/client/src/org/compiere/grid/ed/VLookup.java +++ b/client/src/org/compiere/grid/ed/VLookup.java @@ -179,8 +179,9 @@ public class VLookup extends JComponent // *** VComboBox *** if (m_lookup != null && m_lookup.getDisplayType() != DisplayType.Search) // No Search { - // Memory Leak after executing the next two lines ?? - m_lookup.fillComboBox (isMandatory(), true, true, false); + // Don't have to fill up combobox if it is readonly + if (!isReadOnly && isUpdateable) + m_lookup.fillComboBox (isMandatory(), true, true, false); m_combo.setModel(m_lookup); // AutoCompletion.enable(m_combo); @@ -1339,6 +1340,13 @@ public class VLookup extends JComponent { if (m_lookup == null) return -1; + + //no need to refresh readonly lookup, just remove direct cache + if (!isReadWrite()) { + m_lookup.removeAllElements(); + return 0; + } + return m_lookup.refresh(); } // refresh