We have found several race conditions with the connection termination in the GTK+ port and have switched to make the work queue the only one responsible for closing the socket. We added another platform ifdef to platformInvalidate in ConnectionUnix.cpp. See bug #115880 for more details. Both Anders and Martin suggested that to avoid race conditions this should also be the case of other ports, and the connection queue should take the ownership of the socket descriptor. That way we can get rid of the platform ifdef added to ConnectionUnix.
Created attachment 204370 [details] Patch Proposed patch. By what I can see only Connection::platformInitialize() closes the socket descriptor in the Qt port. This patch moves the loop closing the socket descriptor to SocketNotifier's destructor. SocketNotifier is a new class that inherits from QSocketNotifier. SocketNotifier is destroyed a few lines below the loop in Connection::platformInvalidate(), so this change should keep things working the same as before. I tested this change with the 'Test case' patch in https://bugs.webkit.org/show_bug.cgi?id=115880 and it passes.
Comment on attachment 204370 [details] Patch Qt has been removed, clearing review flags.
=== Bulk closing of Qt bugs === If you believe that this bug report is still relevant for a non-Qt port of webkit.org, please re-open it and remove [Qt] from the summary. If you believe that this is still an important QtWebKit bug, please fill a new report at https://bugreports.qt-project.org and add a link to this issue. See http://qt-project.org/wiki/ReportingBugsInQt for additional guidelines.