mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-30 21:55:31 +02:00
Bug 489676 - Ensure that RSEInitJob is scheduled before waiting for it to complete
There are two versions of RSEInitJob.waitForCompletion: waitForCompletion() waitForCompletion(int phase) The waitForCompletion() version ensures that the job has been scheduled before waiting for it, but not the waitForCompletion(int phase) version. Therefore, if the waitForCompletion(int phase) version is called first, the calling thread can end up waiting for the completion of a job that has never been started. I got in this situation by disabling the auto-start of the RSE UI plugin (in Window, Preferences, General, Startup and Shutdown). Trying to create a remote launch in CDT calls waitForCompletion(int phase), therefore freezing the entire Eclipse. When the auto-start of the RSE UI plugin is enabled, the waitForCompletion() version is called during the initialization of that plugin, so the problem did not appear. The suggested fix is simple, just move the code that ensures the job has been scheduled from waitForCompletion() to waitForCompletion(int phase), so that the job can be scheduled by both versions (since the former is implemented by calling the later). Change-Id: I9f6e5f948c3dbf1be60ddf04af5adbdfcaf3a7eb Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca>
This commit is contained in:
parent
671d63b214
commit
69465ac525
1 changed files with 9 additions and 7 deletions
|
@ -327,13 +327,6 @@ public final class RSEInitJob extends Job {
|
|||
* @throws InterruptedException if the job is interrupted while waiting.
|
||||
*/
|
||||
public IStatus waitForCompletion() throws InterruptedException {
|
||||
RSEInitJob j = getInstance();
|
||||
synchronized(j){
|
||||
if (!_isStarted){
|
||||
j.schedule();
|
||||
_isStarted = true; // make sure no one else schedules this
|
||||
}
|
||||
}
|
||||
waitForCompletion(RSECorePlugin.INIT_ALL);
|
||||
return getResult();
|
||||
}
|
||||
|
@ -348,6 +341,15 @@ public final class RSEInitJob extends Job {
|
|||
*/
|
||||
public IStatus waitForCompletion(int phase) throws InterruptedException {
|
||||
IStatus result = Status.OK_STATUS;
|
||||
RSEInitJob j = getInstance();
|
||||
|
||||
synchronized (j) {
|
||||
if (!_isStarted) {
|
||||
j.schedule();
|
||||
_isStarted = true; // make sure no one else schedules this
|
||||
}
|
||||
}
|
||||
|
||||
switch (phase) {
|
||||
case RSECorePlugin.INIT_MODEL:
|
||||
result = modelPhase.waitForCompletion();
|
||||
|
|
Loading…
Add table
Reference in a new issue