[Pidgin] #15148: Correct an infinite loop when closing a conversation window

Pidgin trac at pidgin.im
Wed Jun 6 16:26:06 EDT 2012


#15148: Correct an infinite loop when closing a conversation window
-------------------+--------------------------------------------------------
Reporter:  dm0     |        Type:  patch            
  Status:  new     |   Component:  pidgin (gtk)     
 Version:  2.10.4  |    Keywords:  bug infinite loop
-------------------+--------------------------------------------------------
 When the pidgin_conv_window_destroy function in gtkconv.c is called, it
 loops on the condition that the list of gtkconvs is not empty.  It expects
 that a call to close_conv_cb will remove the conversations from the list
 on each cycle.  However, when a conversation is not of type
 PURPLE_CONV_TYPE_IM or PURPLE_CONV_TYPE_CHAT, that function simply returns
 without removing the conversation.  This results in an infinite loop if
 there is a conversation with another type in a window when it is closed,
 due to the list of gtkconvs never being emptied.

 The attached patch corrects this with the following intentions:  When an
 attempt is made to close a window (e.g. by choosing "Close all tabs" from
 the notebook menu), it closes every possible tab by iterating over each
 conversation only once.  If every conversation was destroyed, the window
 will be destroyed automatically (as is the default behavior).  If any
 conversations remain--those with unknown type--the window persists with
 only those tabs remaining.

 This is accomplished by changing from a "while" loop to more of a "for
 each" loop, and then by moving the other destructive code in the function
 to after the loop.

 I have a plugin enabled that takes advantage of a conversation type that
 is not IM/Chat, and this patched behavior seems the most natural for the
 given scenario.

-- 
Ticket URL: <http://developer.pidgin.im/ticket/15148>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list