diff options
author | Jan Koehnlein | 2013-09-11 09:57:07 +0000 |
---|---|---|
committer | Jan Koehnlein | 2013-09-11 13:45:48 +0000 |
commit | f71af8838847d9cc0501f6ad5b3a70be925dfd65 (patch) | |
tree | 2ccd0d479cf53477e43e60ab557088c04a6ea72a | |
parent | 142e98ab07b3c94e7d17e56728bbc7a137aa3ebd (diff) | |
download | org.eclipse.swtbot-f71af8838847d9cc0501f6ad5b3a70be925dfd65.tar.gz org.eclipse.swtbot-f71af8838847d9cc0501f6ad5b3a70be925dfd65.tar.xz org.eclipse.swtbot-f71af8838847d9cc0501f6ad5b3a70be925dfd65.zip |
https://bugs.eclipse.org/bugs/show_bug.cgi?id=416994
Lots of "widget is disposed" errors logged when trying to locate a shell
Change-Id: I7f703340c8dd4efc3c2e74a7340ca8841a63ed0d
Signed-off-by: Jan Koehnlein <jan.koehnlein@itemis.de>
2 files changed, 10 insertions, 2 deletions
diff --git a/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/finders/ControlFinder.java b/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/finders/ControlFinder.java index aeecabf1..6a17e163 100644 --- a/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/finders/ControlFinder.java +++ b/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/finders/ControlFinder.java @@ -7,6 +7,7 @@ * * Contributors: * Ketan Padegaonkar - initial API and implementation + * Jan Koehnlein - [bug 416994] filter disposed shells *******************************************************************************/ package org.eclipse.swtbot.swt.finder.finders; @@ -263,7 +264,13 @@ public class ControlFinder { public Shell[] getShells() { return UIThreadRunnable.syncExec(display, new ArrayResult<Shell>() { public Shell[] run() { - return display.getShells(); + Shell[] shells = display.getShells(); + List<Shell> undisposedShells = new ArrayList<Shell>(); + for(Shell shell: shells) { + if(!shell.isDisposed()) + undisposedShells.add(shell); + } + return undisposedShells.toArray(new Shell[undisposedShells.size()]); } }); } diff --git a/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/waits/WaitForShell.java b/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/waits/WaitForShell.java index c3dad1b1..0dcb753d 100644 --- a/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/waits/WaitForShell.java +++ b/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/waits/WaitForShell.java @@ -7,6 +7,7 @@ * * Contributors: * Ketan Padegaonkar - initial API and implementation + * Jan Koehnlein - [bug 416994] filter disposed shells *******************************************************************************/ package org.eclipse.swtbot.swt.finder.waits; @@ -38,7 +39,7 @@ class WaitForShell extends WaitForObjectCondition<Shell> { Shell[] shells = findShells(); ArrayList<Shell> matchingShells = new ArrayList<Shell>(); for (Shell shell : shells) { - if (matcher.matches(shell)) { + if (!shell.isDisposed() && matcher.matches(shell)) { matchingShells.add(shell); } } |