There were a number of cases where immActivate() and immDeactivate() could get out of sync, causing crashes due to using a freed mutex lock. Refactor the code now to hopefully avoid this always.
There were a number of cases where immActivate() and immDeactivate() could get out of sync, causing crashes due to using a freed mutex lock. Refactor the code now to hopefully avoid this always.