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>
1 file changed
tree: a8aa71532f484bcc70cf2efce5a29ee96f53cf1c
  1. admin/
  2. releng/
  3. rse/
  4. wince/
  5. .gitignore
  6. .project
  7. dstoreTargets-git.xml
  8. pom.xml