Menu

delete *it; in ..._disconnects

2007-04-27
2013-04-15
  • Evgeni Rojkov

    Evgeni Rojkov - 2007-04-27

    Hello, I have just a small problem to understand :-).
    Here is a piece of code form some ... disconnect()
    ...
    line1: delete *it;
    line2: m_connected_slots.erase(it);
    line3: // delete *it;
    ...

    Originally the author has eliminated some deletes, but kept them as comments in code.
    So line2 + line3 was the original source.
    In last patch we have line1 + line2 +line3.
    What could be the authors idea, not no have line1 + line2 in the very beginning.
    Doese somebody has an idea ?
    Regards, ev

     
    • Mykhailo Parfeniuk

      line 3 and absence of line 1 in the last version causes memory leaks.
      And a good idea to avoid such behavior is update all slot_disconnect functions with line1

       

Log in to post a comment.