Chat windows in ayttm have given me a bit of a headache for the past couple of nights. There was an innocuous bug that caused a crash when a user had chat windows open and then decided to switch to tabbed chat, opened and then closed the tabbed chat window. It was quite easy to see at first why that happened -- window closure was done based on the tabbed chat preference, and once you have both tabbed and un-tabbed chat windows, it becomes a bit of a mess.
So I finally decided to change the logic behind it all and decided that windows would close based on whether they had a notebook at all. That stopped the original crash case but introduced ten new ones. That was when I found that the smiley window was being deleted twice, the window close signal was attached only to tabbed windows and all new chat windows were added to the chat window list on creation, but only tabbed chat windows were deleted on closure (phew!)
So finally tonight, we've got the finished stuff (hopefully) where all the above issues were taken care of. Gotta love this stuff :)