It is strange that this change was needed for you -- I cannot reproduce any crash if I use the TestLogCollector and disconnect another producer (which is when this line is called).
I would prefer to debug the actual cause of the segfault you are seeing -- could you please revert this commit?