Lets say in my Electrum wallet I have 0.5 BTC which I send to an address, and then a few seconds later send the same 0.5 BTC from my Electrum wallet to another address. (How will this even be allowed by the wallet? does it require hacking into wallet software?)
Your wallet and the server (
connected node) won't allow it.
If you try to send another 0.5 BTC, your wallet will find another UTXOs to spend, not the already used ones.
There are certain conditions before double-spend can be achieved; like marked as "
replaceable" or connection to a miner's node that configured to accept double-spend TXs.
but by using default settings and normal transaction creation procedures, it's not possible to double spend.