mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-02 04:30:25 +08:00
Merge pull request #296 from Karlatemp/patch-4
Fix the error that directly closing the verification code window will block the coroutine.
This commit is contained in:
commit
45d96a8855
@ -22,6 +22,7 @@ import java.awt.event.WindowAdapter
|
|||||||
import java.awt.event.WindowEvent
|
import java.awt.event.WindowEvent
|
||||||
import javax.swing.JFrame
|
import javax.swing.JFrame
|
||||||
import javax.swing.JTextField
|
import javax.swing.JTextField
|
||||||
|
import javax.swing.SwingUtilities
|
||||||
|
|
||||||
// 隔离类代码
|
// 隔离类代码
|
||||||
internal object WindowHelperJvm {
|
internal object WindowHelperJvm {
|
||||||
@ -88,7 +89,9 @@ internal suspend fun openWindow(title: String = "", initializer: WindowInitialzi
|
|||||||
frame.title = title
|
frame.title = title
|
||||||
frame.isVisible = true
|
frame.isVisible = true
|
||||||
|
|
||||||
val result = def.await()
|
val result = def.await().trim()
|
||||||
frame.dispose()
|
SwingUtilities.invokeLater {
|
||||||
|
frame.dispose()
|
||||||
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user