QBuffer *outBuffer = new QBuffer;
QBuffer outBuffer;
d->serverResponses[id] = outBuffer;
delete(outBuffer);outBuffer = 0;
C++ (Qt)void Client::requestFinished(int id, bool error){ if ( !d->serverResponses.count(id) ) { return; } #ifdef XMLRPC_DEBUG qDebug() << "request" << d->methodNames[id] << "finished, id=" << id << ", isError:" << error;#endif if ( error ) { //if ( d->serverResponses.count(id) ) delete d->serverResponses.take(id); emit failed(id, -32300, d->http->errorString() ); return; } if ( d->serverResponses.count(id) ) { QBuffer * inBuffer = d->serverResponses.take(id); QByteArray buf = inBuffer->buffer(); //qDebug() << "xml-rpc server response:\n" << QString(buf); Response response; QString errorMessage; if ( response.setContent( buf, &errorMessage ) ) { Q_ASSERT( !response.isNull() ); if ( response.isFault() ) { qDebug() << "request failed:" << response.faultCode() << response.faultString(); emit failed(id, response.faultCode(), response.faultString() ); } else {#ifdef XMLRPC_DEBUG qDebug() << response.returnValue().pprint();#endif emit done( id, response.returnValue() ); } } else { #ifdef XMLRPC_DEBUG qDebug() << "incorrect xmlrpc response:" << errorMessage; qDebug() << QString(buf);#endif emit failed(id, -32600, "Server error: Invalid xml-rpc. \nNot conforming to spec."); } delete inBuffer; } }