Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimeon Andreev2020-03-02 08:59:07 -0500
committerSimeon Andreev2020-03-02 09:16:31 -0500
commit697bfc6d52100863ae803e2baa7d94968cae3b7b (patch)
treeac4eac4179f14b8df1b8163f0791c43bed4122c0
parent8c7febc9b47c3530140a8974b17c73543675cd2a (diff)
downloadeclipse.platform.swt-697bfc6d52100863ae803e2baa7d94968cae3b7b.tar.gz
eclipse.platform.swt-697bfc6d52100863ae803e2baa7d94968cae3b7b.tar.xz
eclipse.platform.swt-697bfc6d52100863ae803e2baa7d94968cae3b7b.zip
Bug 484682 - test snippet for StackOverflowError in tree
This change adds a snippet to reproduce the problem with. Change-Id: I266a992ee7745ad9eaf11c0c5226374aa928ab5f Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com> Also-By: Mark Peters <mpeters985@yahoo.com>
-rw-r--r--tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug484682_TreeEditorStackOverflow.java73
1 files changed, 73 insertions, 0 deletions
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug484682_TreeEditorStackOverflow.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug484682_TreeEditorStackOverflow.java
new file mode 100644
index 0000000000..95acfe8527
--- /dev/null
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug484682_TreeEditorStackOverflow.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Mark Peters and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Mark Peters - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.tests.gtk.snippets;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.TreeEditor;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.TreeItem;
+/*
+ * Title: Bug 484682: [GTK3] Stack overflow due to tree editor resizes
+ * How to run: Run snippet.
+ * Bug description: A stack overflow exception is thrown, during a tree editor resize.
+ * Expected results: No stack overflow occurs.
+ * GTK Version(s): GTK3.22.10
+ */
+public class Bug484682_TreeEditorStackOverflow {
+
+ public static void main(String[] args) {
+ Display display = new Display();
+
+ Shell shell = new Shell(display, SWT.DIALOG_TRIM);
+ shell.setLayout(new FillLayout());
+
+ // Create a tree
+ Tree tree = new Tree(shell, SWT.NONE);
+ tree.setHeaderVisible(true);
+
+ new TreeColumn(tree, SWT.NONE);
+ TreeColumn lastColumn = new TreeColumn(tree, SWT.NONE);
+
+ shell.pack();
+
+ // Need to have vertical scrollbar and not have horizontal scrollbar
+ shell.setSize(2000, 100);
+
+ shell.open();
+
+ TreeItem item = new TreeItem(tree, SWT.NONE);
+ item.setText(0, "test");
+ new TreeEditor(tree).setEditor(new Canvas(tree, SWT.NONE), item, 1);
+
+ lastColumn.pack();
+
+ // Create rows
+ for (int i = 0; i < 10; ++i) {
+ new TreeItem(tree, SWT.NONE);
+ }
+
+ lastColumn.pack();
+
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) {
+ display.sleep();
+ }
+ }
+ }
+} \ No newline at end of file

Back to the top