stopping wallet rpc instance does not assume to close wallet

This commit is contained in:
woodser 2022-06-27 21:21:32 -04:00
parent 7ad2e20d95
commit f17c5803b5
3 changed files with 17 additions and 9 deletions

View file

@ -97,9 +97,8 @@ public class MoneroWalletRpcManager {
* Stop an instance of monero-wallet-rpc. * Stop an instance of monero-wallet-rpc.
* *
* @param walletRpc the client connected to the monero-wallet-rpc instance to stop * @param walletRpc the client connected to the monero-wallet-rpc instance to stop
* @param save specifies if the wallet should be saved before closing
*/ */
public void stopInstance(MoneroWalletRpc walletRpc, boolean save) { public void stopInstance(MoneroWalletRpc walletRpc) {
// unregister port // unregister port
synchronized (registeredPorts) { synchronized (registeredPorts) {
@ -118,8 +117,7 @@ public class MoneroWalletRpcManager {
if (!found) throw new RuntimeException("MoneroWalletRpc instance not registered with a port"); if (!found) throw new RuntimeException("MoneroWalletRpc instance not registered with a port");
} }
// close wallet and stop process // stop process
walletRpc.close(save);
walletRpc.stopProcess(); walletRpc.stopProcess();
} }

View file

@ -40,6 +40,7 @@ import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import javax.inject.Inject; import javax.inject.Inject;
import monero.common.MoneroError;
import monero.common.MoneroRpcConnection; import monero.common.MoneroRpcConnection;
import monero.common.MoneroUtils; import monero.common.MoneroUtils;
import monero.daemon.MoneroDaemon; import monero.daemon.MoneroDaemon;
@ -434,7 +435,7 @@ public class XmrWalletService {
return walletRpc; return walletRpc;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
MONERO_WALLET_RPC_MANAGER.stopInstance(walletRpc, false); MONERO_WALLET_RPC_MANAGER.stopInstance(walletRpc);
throw e; throw e;
} }
} }
@ -451,7 +452,7 @@ public class XmrWalletService {
return walletRpc; return walletRpc;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
MONERO_WALLET_RPC_MANAGER.stopInstance(walletRpc, false); MONERO_WALLET_RPC_MANAGER.stopInstance(walletRpc);
throw e; throw e;
} }
} }
@ -549,7 +550,14 @@ public class XmrWalletService {
private void closeWallet(MoneroWallet walletRpc, boolean save) { private void closeWallet(MoneroWallet walletRpc, boolean save) {
log.info("{}.closeWallet({}, {})", getClass().getSimpleName(), walletRpc.getPath(), save); log.info("{}.closeWallet({}, {})", getClass().getSimpleName(), walletRpc.getPath(), save);
MONERO_WALLET_RPC_MANAGER.stopInstance((MoneroWalletRpc) walletRpc, save); MoneroError err = null;
try {
walletRpc.close(save);
} catch (MoneroError e) {
err = e;
}
MONERO_WALLET_RPC_MANAGER.stopInstance((MoneroWalletRpc) walletRpc);
if (err != null) throw err;
} }
private void deleteWallet(String walletName) { private void deleteWallet(String walletName) {

View file

@ -19,7 +19,7 @@ package bisq.desktop.components;
import de.jensd.fx.fontawesome.AwesomeDude; import de.jensd.fx.fontawesome.AwesomeDude;
import de.jensd.fx.fontawesome.AwesomeIcon; import de.jensd.fx.fontawesome.AwesomeIcon;
import bisq.common.UserThread;
import com.jfoenix.controls.JFXTextField; import com.jfoenix.controls.JFXTextField;
import javafx.scene.control.Label; import javafx.scene.control.Label;
@ -66,7 +66,9 @@ public class TextFieldWithIcon extends AnchorPane {
} }
public void setIcon(AwesomeIcon iconLabel) { public void setIcon(AwesomeIcon iconLabel) {
AwesomeDude.setIcon(this.iconLabel, iconLabel); UserThread.execute(() -> {
AwesomeDude.setIcon(this.iconLabel, iconLabel);
});
} }
public void setText(String text) { public void setText(String text) {