Get rid of sessionsInstance altogether and make PTYSession hold the only reference to the divorced profile
Prior to commit d88dc762, this was a frequent crash:
Application Specific Information:
Assertion failed: (newProfile), function -[PTYSession setProfile:], file /Users/gnachman/iTerm2/sources/PTYSession.m, line 3189.
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff9b9c2286 __pthread_kill + 10
1 libsystem_c.dylib 0x00007fff95a659ab abort + 129
2 libsystem_c.dylib 0x00007fff95a2da91 __assert_rtn + 321
3 com.googlecode.iterm2 0x00000001093950bf -[PTYSession setProfile:] + 499
4 com.googlecode.iterm2 0x0000000109392af6 -[PTYSession sessionProfileDidChange] + 917
5 com.googlecode.iterm2 0x0000000109392d56 -[PTYSession reloadProfile] + 495
(various causes above this frame)
That commit was just a gross workaround.
The real fix is to get rid of sessionInstance.