{"issue":{"created_at":"2011-12-08T14:08:36Z","state":"open","updated_at":"2011-12-08T14:42:49Z","comments":1,"user":{"gravatar_id":"de5f00cf93a4debecd0ce8c13fc91509","id":831184,"url":"https://api.github.com/users/Mkaysi","avatar_url":"https://secure.gravatar.com/avatar/de5f00cf93a4debecd0ce8c13fc91509?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"Mkaysi"},"body":"I tried to  remove account (which I used only to test issue #94) which was just clone of my main account and it was fixed to partyline channel. I did this with *admin module (log below).\r\n\r\n<Mkaysi\b>\b\u000Fdeluser Mkaysi-test\r\n\u0003<\b*admin\b>\b\u000F User Mkaysi-test deleted!\r\n* Yhteys katkaistu (Vastapää sulki pistokkeen).\r\n(* Disconnected (remote host closed the connection).)\r\n\r\nWe were running ZNC with --debug and the last thing in output is:\r\n\r\n(Mkaysi) CLI -> ZNC [PRIVMSG *admin :deluser Mkaysi-test]\r\ncharset: [PRIVMSG+%2Aadmin+%3Adeluser+Mkaysi-test] is valid [UTF-8] already.\r\n(Mkaysi) ZNC -> CLI [:*admin!znc@znc.in PRIVMSG Mkaysi :User Mkaysi-test deleted!]\r\n/usr/include/c++/4.4/debug/safe_iterator.h:204:error: attempt to increment \r\n    a singular iterator.\r\n\r\nObjects involved in the operation:\r\niterator \"this\" @ 0x0x7fffd130fea0 {\r\ntype = N11__gnu_debug14_Safe_iteratorISt23_Rb_tree_const_iteratorIP17CPartylineChannelENSt7__debug3setIS3_St4lessIS3_ESaIS3_EEEEE (mutable iterator);\r\n  state = singular;\r\n  references sequence with type `NSt7__debug3setIP17CPartylineChannelSt4lessIS2_ESaIS2_EEE' @ 0x0x7fffd130fea0\r\n}\r\nzsh: abort      znc --debug\r\n","assignee":null,"id":2487863,"number":96,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"labels":[{"name":"Bug","color":"e10c02","url":"https://api.github.com/repos/znc/znc/labels/Bug"}],"title":"ZNC crashes when user which is fixed to partyline channel is deleted.","html_url":"https://github.com/znc/znc/issues/96","closed_at":null,"url":"https://api.github.com/repos/znc/znc/issues/96","milestone":null},"action":"created","comment":{"created_at":"2011-12-08T14:42:49Z","updated_at":"2011-12-08T14:42:49Z","user":{"gravatar_id":"d200a17dd269fd4001bacb11662dab4b","id":44164,"url":"https://api.github.com/users/kylef","avatar_url":"https://secure.gravatar.com/avatar/d200a17dd269fd4001bacb11662dab4b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"kylef"},"body":"I can reproduce, it looks like the problem lies where partyline invalidates iterators by erasing the channel in this case. The code which is causing this is as follows:\r\n\r\n\tvirtual EModRet OnDeleteUser(CUser& User) {\r\n\t\t// Loop through each chan\r\n\t\tfor (set<CPartylineChannel*>::iterator it = m_ssChannels.begin(); it != m_ssChannels.end(); ++it) {\r\n\t\t\tRemoveUser(&User, *it, \"KICK\", \"User deleted\", true);\r\n\t\t}\r\n\r\n\t\treturn CONTINUE;\r\n\t}\r\n\r\n\r\n\tvoid RemoveUser(CUser* pUser, CPartylineChannel* pChannel, const CString& sCommand,\r\n\t\t\tconst CString& sMessage = \"\", bool bNickAsTarget = false) {\r\n\r\n                ...\r\n\r\n\t\tif (ssNicks.empty()) {\r\n\t\t\tdelete pChannel;\r\n\t\t\tm_ssChannels.erase(pChannel);\r\n\t\t}\r\n\t}\r\n\r\nAnd a full backtrace.\r\n\r\n    (gdb) bt full\r\n    #0  0x00007ffff6b45965 in raise () from /lib/libc.so.6\r\n    No symbol table info available.\r\n    #1  0x00007ffff6b46ddb in abort () from /lib/libc.so.6\r\n    No symbol table info available.\r\n    #2  0x00007ffff7118ddd in __gnu_debug::_Error_formatter::_M_error() const ()\r\n       from /usr/lib/libstdc++.so.6\r\n    No symbol table info available.\r\n    #3  0x00007ffff52ff92c in __gnu_debug::_Safe_iterator<std::_Rb_tree_const_iterator<CPartylineChannel*>, std::__debug::set<CPartylineChannel*, std::\r\n    less<CPartylineChannel*>, std::allocator<CPartylineChannel*> > >::operator++ (\r\n        this=0x7fffffffe210)\r\n        at /usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.2/../../../../include/c++/4.6.2/debug/safe_iterator.h:220\r\n    No locals.\r\n    #4  0x00007ffff52f49bf in CPartylineMod::OnDeleteUser (this=0x953bf0, User=...)\r\n        at partyline.cpp:126\r\n            it = {<__gnu_debug::_Safe_iterator_base> = {_M_sequence = 0x953de8, \r\n                _M_version = 0, _M_prior = 0x0, _M_next = 0x0}, _M_current = {\r\n                _M_node = 0x952890}}\r\n    #5  0x000000000061b068 in CModules::OnDeleteUser (this=0x946c90, User=...)\r\n        at src/Modules.cpp:747\r\n            pMod = 0x953bf0\r\n    ---Type <return> to continue, or q <return> to quit---\r\n            e = CModule::CONTINUE\r\n            pOldClient = 0x0\r\n            pOldUser = 0x0\r\n            pNetwork = 0x0\r\n            a = 2\r\n            bHaltCore = false\r\n    #6  0x000000000057e893 in CZNC::HandleUserDeletion (this=0x92e040)\r\n        at src/znc.cpp:118\r\n            pUser = 0x94eae0\r\n            it = {<__gnu_debug::_Safe_iterator_base> = {_M_sequence = 0x92e100, \r\n                _M_version = 1, _M_prior = 0x0, _M_next = 0x7fffffffe360}, \r\n              _M_current = {_M_node = 0x94bef0}}\r\n            end = {<__gnu_debug::_Safe_iterator_base> = {_M_sequence = 0x92e100, \r\n                _M_version = 1, _M_prior = 0x7fffffffe330, _M_next = 0x0}, \r\n              _M_current = {_M_node = 0x92e0d8}}\r\n    #7  0x000000000057ebcf in CZNC::Loop (this=0x92e040) at src/znc.cpp:161\r\n            sError = {<std::basic_string<char, std::char_traits<char>, std::allocator<char> >> = {static npos = <optimized out>, \r\n                _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, \r\n                  _M_p = 0x92cf38 \"\"}}, <No data fields>}\r\n    #8  0x000000000054a8f7 in main (argc=2, argv=0x7fffffffe958)\r\n    ---Type <return> to continue, or q <return> to quit---\r\n        at src/main.cpp:320\r\n            sConfig = {<std::basic_string<char, std::char_traits<char>, std::allocator<char> >> = {static npos = <optimized out>, \r\n                _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, \r\n                  _M_p = 0x92cf38 \"\"}}, <No data fields>}\r\n            iOptIndex = -1\r\n            bForeground = true\r\n            bMakePass = false\r\n            bAllowRoot = false\r\n            pZNC = 0x92e040\r\n            sa = {__sigaction_handler = {sa_handler = 0x549a50 <die(int)>, \r\n                sa_sigaction = 0x549a50 <die(int)>}, sa_mask = {__val = {\r\n                  0 <repeats 16 times>}}, sa_flags = -2147483648, \r\n              sa_restorer = 0x1}\r\n            iRet = 0\r\n            sDataDir = {<std::basic_string<char, std::char_traits<char>, std::allocator<char> >> = {static npos = <optimized out>, \r\n                _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, \r\n                  _M_p = 0x92cf38 \"\"}}, <No data fields>}\r\n            iArg = -1\r\n    ---Type <return> to continue, or q <return> to quit---\r\n            bMakeConf = false\r\n            bMakePem = false\r\n    (gdb) \r\n","id":3063071,"url":"https://api.github.com/repos/znc/znc/issues/comments/3063071"}}