|
Lines 16-22
Link Here
|
| 16 |
import org.eclipse.swt.events.TraverseListener; |
16 |
import org.eclipse.swt.events.TraverseListener; |
| 17 |
import org.eclipse.swt.graphics.Image; |
17 |
import org.eclipse.swt.graphics.Image; |
| 18 |
import org.eclipse.swt.graphics.Point; |
18 |
import org.eclipse.swt.graphics.Point; |
|
|
19 |
import org.eclipse.swt.internal.Lock; |
| 20 |
import org.eclipse.swt.internal.Platform; |
| 19 |
import org.eclipse.swt.widgets.Control; |
21 |
import org.eclipse.swt.widgets.Control; |
|
|
22 |
import org.eclipse.swt.widgets.Display; |
| 20 |
|
23 |
|
| 21 |
import org.eclipse.core.runtime.CoreException; |
24 |
import org.eclipse.core.runtime.CoreException; |
| 22 |
import org.eclipse.core.runtime.IProgressMonitor; |
25 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
Lines 298-308
Link Here
|
| 298 |
* @throws CoreException thrown when the change could not be created |
301 |
* @throws CoreException thrown when the change could not be created |
| 299 |
*/ |
302 |
*/ |
| 300 |
public final Change getChange() throws CoreException { |
303 |
public final Change getChange() throws CoreException { |
| 301 |
if (Util.isGtk()) { |
304 |
if (Util.isGtk() && Display.getCurrent() != null) { |
| 302 |
// workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=293995 : |
305 |
// workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=293995 : |
| 303 |
// [Widgets] Deadlock while UI thread displaying/computing a change proposal and non-UI thread creating image |
306 |
// [Widgets] Deadlock while UI thread displaying/computing a change proposal and non-UI thread creating image |
| 304 |
if (fChange == null) { |
307 |
|
| 305 |
fChange= createChange(); |
308 |
//Copied from Display#sleep(): |
|
|
309 |
/* Exit the OS lock to allow other threads to enter GTK */ |
| 310 |
Lock lock = Platform.lock; |
| 311 |
int count = lock.lock (); |
| 312 |
for (int i = 0; i < count; i++) lock.unlock (); |
| 313 |
try { |
| 314 |
synchronized (this) { |
| 315 |
if (fChange == null) { |
| 316 |
fChange= createChange(); |
| 317 |
} |
| 318 |
} |
| 319 |
} finally { |
| 320 |
for (int i = 0; i < count; i++) lock.lock (); |
| 321 |
lock.unlock (); |
| 306 |
} |
322 |
} |
| 307 |
} else { |
323 |
} else { |
| 308 |
synchronized (this) { |
324 |
synchronized (this) { |