KDSoap
KDSoap copied to clipboard
crash in KDSoapClientThread -> KDSoapPendingCall::Private::~Private
Hello,
my team is running into the following problem:
We used the KDSoap code generation for the following code:
PocuseServiceClient::TNS__DoBusinessTaskResponse PocuseServiceClient::PocuseService::PocuseServiceSoap::doBusinessTask( const PocuseServiceClient::TNS__DoBusinessTask& parameters ) { const QString action = QString::fromLatin1("http://www.prite.com/wsdl/doBusinessTask"); KDSoapMessage message; message.setUse(KDSoapMessage::LiteralUse); KDSoapValue _valueDoBusinessTask(parameters.serialize(QString::fromLatin1("doBusinessTask")));// .\converter_complextype.cpp:209 _valueDoBusinessTask.setNamespaceUri(QString::fromLatin1("http://www.prite.com/wsdl/")); _valueDoBusinessTask.setQualified(true); message = _valueDoBusinessTask;// .\converter_complextype.cpp:223 d_ptr->m_lastReply = clientInterface()->call(QLatin1String("doBusinessTask"), message, action); if (d_ptr->m_lastReply.isFault()) return PocuseServiceClient::TNS__DoBusinessTaskResponse(); PocuseServiceClient::TNS__DoBusinessTaskResponse ret; ret.deserialize(d_ptr->m_lastReply);// .\converter_clientstub.cpp:519 return ret;// .\converter_clientstub.cpp:573 }
However, it is crashing when executing the following line: d_ptr->m_lastReply = clientInterface()->call(QLatin1String("doBusinessTask"), message, action); It crashes in the KDSoapClientThread in a QScopedPointerDeleter::cleanup(...) method. Here it is deleting an already deleted object. Obviously this is the problem, but we don't have control over this section of the KDSoap code. Looking at the call stack of this thread I see that the KDSoapPendingCall::Private::~Private destructor is involved. Also I have no idea which object the scopedpointer tries to delete and where it already got deleted.
How can we debug this?
Thanks Stefan
If you can run this code on Linux (or Mac OS X), then the easiest way to debug this is by running the application (or a testcase) in "valgrind".
For best results, use this command line:
QT_ENABLE_REGEXP_JIT=0 valgrind --tool=memcheck --partial-loads-ok=yes ./applicationname
Unfortunately we are not developing for mac or Linux at this time. What about windows / Visual Studio?
Hi David, when building the provided hello_world client example with Visual Studio instead of QtCreator, we get the same crash. Attached is the zipped project.
Is there anything special we need to do with Visual Studio in order to get it right? Are there special DEFINES or compiler flags to set?
It looks like I've found a fix for this issue:
In KDSoapPendingCall.cpp:32 change
delete reply.data();
to
reply.data()->deleteLater();
Thanks for the fix, we will check this out next week most probably. Best regards. Franck
That's not complete fix. I found that program still crash if you delete Client object while there are pending requests.
Some hacky workaround is to manually delete all children of Client object that are KDSoapPendingCallWatcher before calling
delete d_ptr->m_clientInterface;