Hi Bill, I looked over your code and didn't see anything wrong with your logic until I read the code for g_mime_multipart_foreach().
If the callback function removes an item from the children array, then the iterator variable (i) should not increment since children->len will decrement. I'm not sure if this should be considered a bug in GMime or not (it could easily be argued both ways). In any event, one solution you could use in the meantime is iterating over the parts yourself. In the future, I could change the way g_mime_multipart_foreach() works in that I could make it copy the children array into another temporary array such that any mutations the callback does to the GMimeMultipart does not cause any interruptions in the iteration of all of the original mime parts that existed at the time of the call. However, this might cause confusion if a callback removes multiple items (should the foreach call the callback on the removed parts if they haven't been reached yet?). I'll have to check to see what other foreach implementations do (like what would C# do if the list is mutated in the body of the foreach?). Very interesting bug... ;-) Jeff _______________________________________________ gmime-devel-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gmime-devel-list
