From aa82cbdb36e663429ae99d4a44d7f07522326533 Mon Sep 17 00:00:00 2001 From: irengrig Date: Tue, 7 Feb 2012 13:04:54 +0400 Subject: [PATCH] SVN+SSH: fingerprints: avoid deadlock (asked from background threadlead thread, but we might have ex update options dialog box showing modal simultaneously + auth progress) --- .../SvnInteractiveAuthenticationProvider.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn17/dialogs/SvnInteractiveAuthenticationProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn17/dialogs/SvnInteractiveAuthenticationProvider.java index 7323a2ae2628..34cb4dff294c 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn17/dialogs/SvnInteractiveAuthenticationProvider.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn17/dialogs/SvnInteractiveAuthenticationProvider.java @@ -17,6 +17,8 @@ package org.jetbrains.idea.svn17.dialogs; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.progress.ProgressIndicator; +import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.MessageType; import com.intellij.openapi.vcs.ui.VcsBalloonProblemNotifier; @@ -31,7 +33,9 @@ import org.tmatesoft.svn.core.SVNErrorMessage; import org.tmatesoft.svn.core.SVNURL; import org.tmatesoft.svn.core.auth.*; +import javax.swing.*; import java.io.File; +import java.lang.reflect.InvocationTargetException; import java.security.cert.X509Certificate; public class SvnInteractiveAuthenticationProvider implements ISVNAuthenticationProvider { @@ -200,7 +204,20 @@ public class SvnInteractiveAuthenticationProvider implements ISVNAuthenticationP MessageType.ERROR); return REJECTED; } - WaitForProgressToShow.runOrInvokeAndWaitAboveProgress(command); + final ProgressIndicator pi = ProgressManager.getInstance().getProgressIndicator(); + if (pi != null) { + WaitForProgressToShow.runOrInvokeAndWaitAboveProgress(command, pi.getModalityState()); + } else { + try { + SwingUtilities.invokeAndWait(command); + } + catch (InterruptedException e) { + // + } + catch (InvocationTargetException e) { + // + } + } return result[0]; }