I can reproduce an issue with master; v0.17.1rc1 works fine.

Steps to reproduce:
- `bitcoin-qt -regtest`
- open Console window
- repeat `generatetoaddress 1 AN_ADDRESS` some times until crash

Crash occurs both on wayland and x11.

[debug.log](https://github.com/bitcoin/bitcoin/files/2690776/debug.log)

[wallets.zip](https://github.com/bitcoin/bitcoin/files/2690781/wallets.zip)
unitDisplayControl->setOptionsModel(_clientModel->getOptionsModel());
        OptionsModel* optionsModel = _clientModel->getOptionsModel();
        if(optionsModel)
        {
            
            connect(optionsModel, &OptionsModel::hideTrayIconChanged, this, &BitcoinGUI::setTrayIconVisible);
            
            setTrayIconVisible(optionsModel->getHideTrayIcon());
        }
    } else {
        
        toggleHideAction->setEnabled(false);
        if(trayIconMenu)
        {
            
            trayIconMenu->clear();
        }
        
        rpcConsole->setClientModel(nullptr);
#ifdef ENABLE_WALLET
        if (walletFrame)
        {
            walletFrame->setClientModel(nullptr);
        }
#endif 
        unitDisplayControl->setOptionsModel(nullptr);
    }
}
#ifdef ENABLE_WALLET
bool BitcoinGUI::addWallet(WalletModel *walletModel)