This is an automated email from the ASF dual-hosted git repository.

hansva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git


The following commit(s) were added to refs/heads/main by this push:
     new 9acaae4171 add some extra safety to dispose the editor, fixes #6363 
(#6364)
9acaae4171 is described below

commit 9acaae4171bcd6ec9ebd598d3434b8a7d5fd52d0
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Tue Jan 13 15:18:14 2026 +0100

    add some extra safety to dispose the editor, fixes #6363 (#6364)
---
 .../org/apache/hop/ui/core/widget/TableView.java   | 38 +++++++++++++++-------
 1 file changed, 26 insertions(+), 12 deletions(-)

diff --git a/ui/src/main/java/org/apache/hop/ui/core/widget/TableView.java 
b/ui/src/main/java/org/apache/hop/ui/core/widget/TableView.java
index 2421827ffb..89efb73200 100644
--- a/ui/src/main/java/org/apache/hop/ui/core/widget/TableView.java
+++ b/ui/src/main/java/org/apache/hop/ui/core/widget/TableView.java
@@ -2300,12 +2300,19 @@ public class TableView extends Composite {
     int[] items = table.getSelectionIndices();
     table.setSelection(items);
 
-    // Check if there is an active control (active textbox/combobox/...) and 
dispose it when
-    // deleting a row
-    Control activeControl = 
getActiveTableItem().getDisplay().getFocusControl();
-    // Check if the table is the parent
-    if (activeControl != null && activeControl.getParent().equals(table)) {
-      activeControl.dispose();
+    // Check if there is an active editor and save its value before deleting 
rows
+    // This prevents the editor value from being saved to the wrong row
+    if (text != null && !text.isDisposed() && lsFocusText != null) {
+      lsFocusText.focusLost(null);
+      // Text focus lost handler disposes the control itself
+    } else if (combo != null && !combo.isDisposed() && lsFocusCombo != null) {
+      lsFocusCombo.focusLost(null);
+      // Combo focus lost handler doesn't dispose, so we need to do it
+      safelyDisposeControl(combo);
+    } else if (comboVar != null && !comboVar.isDisposed() && lsFocusCombo != 
null) {
+      lsFocusCombo.focusLost(null);
+      // ComboVar focus lost handler doesn't dispose, so we need to do it
+      safelyDisposeControl(comboVar);
     }
 
     if (items.length == 0) {
@@ -2402,12 +2409,19 @@ public class TableView extends Composite {
     ta.setDelete(before, itemsToDelete);
     addUndo(ta);
 
-    // Check if there is an active control (active textbox/combobox/...) and 
dispose it when
-    // deleting a row
-    Control activeControl = 
getActiveTableItem().getDisplay().getFocusControl();
-    // Check if the table is the parent
-    if (activeControl != null && activeControl.getParent().equals(table)) {
-      activeControl.dispose();
+    // Check if there is an active editor and save its value before deleting 
rows
+    // This prevents the editor value from being saved to the wrong row
+    if (text != null && !text.isDisposed() && lsFocusText != null) {
+      lsFocusText.focusLost(null);
+      // Text focus lost handler disposes the control itself
+    } else if (combo != null && !combo.isDisposed() && lsFocusCombo != null) {
+      lsFocusCombo.focusLost(null);
+      // Combo focus lost handler doesn't dispose, so we need to do it
+      safelyDisposeControl(combo);
+    } else if (comboVar != null && !comboVar.isDisposed() && lsFocusCombo != 
null) {
+      lsFocusCombo.focusLost(null);
+      // ComboVar focus lost handler doesn't dispose, so we need to do it
+      safelyDisposeControl(comboVar);
     }
 
     // Delete non-selected items.

Reply via email to