         }
 
         private function onCodecError(error:CodecError):void {
-            // The query dies, but the connection is fine
+            // The query dies, but the connection is fine. We clean up
+            // the query handler on ReadyForQuery
             _connHandler.handleCodecError(error);
-            _currentQueryHandler.dispose();
-            _currentQueryHandler = null;
             // Note that we still may need to throw away any number of DataRow messages
             _hasCodecError = true;
         }

                    // if the server is processing messages in a sensible manner) that we will
                    // ignore it for now.
                    _currentQueryHandler.handleData(_currResults, serverParams);
                    _currResults = [];
                } catch (e:CodecError) {
                     onCodecError(e);
                }
            }
        }


            // to handle this differently, but there's little practical use for that.
            if (_currentQueryHandler) {
                _currentQueryHandler.handleCompletion('EMPTY QUERY');
            } else {
                onProtocolError(new ProtocolError("Unexpected EmptyQueryResponse"));
            }
