Be sure to clean up in the right order when unloading
We should only free the userstate after all the pidgin stuff is cleaned up, as some of it may use the context. Indeed, this fixes a crash bug when you try to unload the OTR module while a SMP session is in progress. The right thing to do is to deallocate things in the reverse order that you allocated them, which is what we do now.
Showing with 9 additions and 7 deletions