Qt , QMutex: destroying locked mutex then app crash
<p>I make an http operation(get,post etc...) by using QNetworkAccessManager. I run a few "get" operation in paralel. For this , I use QtConcurrent::run(this,&amp;RestWebservice::GetHTTPData) to make multi HTTP operations.
My problem is When I close the app  before HTTP operation does not complete , App is crashed.Application Output write this line <strong>QMutex: destroying locked mutex</strong> then write <strong>The program has unexpectedly finished.</strong>
I guest problem occurs in this line </p>

<pre><code>void RestWebservice::get()
{
 //  mutex.lock();
  m_networkManager.get(m_networkrequest);
//  mutex.unlock();


}
</code></pre>

<p>But I am not sure because QtCreater Debugger is not good like VS.By the way , GetHTTPData is in different class.</p>

<p>MY CODE for start network Operation:(MobileOperation.cpp).For exapmle getUserAccount metod start a http operation. </p>

<pre><code>void MobileOperations::getWorkOrderListT(int ekipId) {


  MyGlobal::Metods metod=MyGlobal::EkipIsEmriListesi;
    QString parameters="{EkipId}";
    QMap&lt;QString,QVariant&gt; paramlist;

    paramlist["EkipId"]=ekipId;

    GetHTTPData(metod,parameters,paramlist);

    if(m_workorder.IsSuccess==true)
    {

        // emit successupdatewo();

            if(m_workorder.workorders.count()&gt;0)
            {
                InsertWo(json.workorder-&gt;workorders);
             emit processstop("İş Emri Listesi Güncellendi");




             // QThread::sleep(2);
            }
           else
            {
                emit processstop(json.workorder-&gt;ReturnMessage);
            }

            emit successworkstart();

    }
    else
    {
        emit processstop("Bağlantı Başarısız Oldu");
    }


}
  void MobileOperations::getUserAccount(QString kullaniciAdi, QString sifre,bool isremember)
{
    json.user=m_user;

    QtConcurrent::run(this,&amp;MobileOperations::getUserAccountT,kullaniciAdi,sifre,isremember);
   // getUserAccountT(kullaniciAdi,sifre,isremember);
    processstart("Baglaniyor");




}






void MobileOperations::GetHTTPData(MyGlobal::Metods MetodName, QString Parameters, QMap&lt;QString, QVariant&gt; paramlist)
{

    try
    {
    parameter=new HttpRequest();
    parameter-&gt;url=m_url;
    parameter-&gt;metodname=MetodName;
    parameter-&gt;resource=m_path;
    parameter-&gt;appid=m_appid;
    parameter-&gt;apppass=m_apppass;
    parameter-&gt;parametersname=Parameters;
    parameter-&gt;params=paramlist;
    rest= new RestWebservice(parameter-&gt;GenerateHTTPQuery(),MetodName);
   // json=new JSonParser();
  //  loop=new QEventLoop();

     loop=new QEventLoop();
     QObject::connect(rest,SIGNAL(sendhttpdata(QByteArray,MyGlobal::Metods)),&amp;json,SLOT(onGetData(QByteArray,MyGlobal::Metods)));
     QObject::connect(&amp;json,SIGNAL(serilazitionCompleted()),loop,SLOT(quit()));
     rest-&gt;get();
     loop-&gt;exec();
    }

    catch(std::string &amp;exp)
    {
        qDebug()&lt;&lt;"Sonlandırıldı";
    }

}
</code></pre>

<p>MY   CODE of classes For HTTP operatins : </p>

<pre><code>#include "restwebservice.h"
#include &lt;QJsonDocument&gt;
#include&lt;QJsonArray&gt;
#include &lt;QJsonObject&gt;
#include&lt;QJsonValue&gt;
#include&lt;QList&gt;
#include &lt;QThread&gt;




RestWebservice::RestWebservice(QNetworkRequest request,
                               MyGlobal::Metods metod,
                               QObject* parent):QObject(parent),m_networkrequest(request),m_metodname(metod)
{


    connect(&amp;m_networkManager, SIGNAL(finished(QNetworkReply*)),this, SLOT(onResult(QNetworkReply*)));
//    connect(&amp;m_networkManager,SIGNAL())

}

void RestWebservice::get()
{
  //  mutex.lock();
  m_networkManager.get(m_networkrequest);
//  mutex.unlock();


}

void RestWebservice::post(QString request)
{

   QByteArray requestA= request.toUtf8();
    m_networkManager.post(m_networkrequest,requestA);
}

void RestWebservice::onResult(QNetworkReply* reply)
{
    try
    {
      if (reply-&gt;error() != QNetworkReply::NoError)
        {



              qDebug()&lt;&lt;reply-&gt;error()&lt;&lt;":"&lt;&lt;reply-&gt;errorString();
               MyGlobal::NetworkStatus=reply-&gt;errorString();
              emit sendhttpdata(m_data,m_metodname);
              return;

             //  throw(reply-&gt;errorString().toStdString());



        }



         QByteArray data = reply-&gt;readAll();

         reply-&gt;deleteLater();
         m_data=data;

         MyGlobal::NetworkStatus="Tablolar Yüklendi";
        emit sendhttpdata(m_data,m_metodname);


}

    catch(std::string exp)
    {
        qDebug()&lt;&lt;"Exception:"&lt;&lt;QString::fromStdString(exp);


    }

   catch(std::exception &amp;exp)
    {
        qDebug()&lt;&lt;"Exception:"&lt;&lt;QString::fromStdString(exp.what());
    }


}

void RestWebservice::onError()
{


    qDebug()&lt;&lt;"Hata VAR";
}


HttpRequest::HttpRequest(QObject *parent) :
    QObject(parent)
{

}

QNetworkRequest HttpRequest::GenerateHTTPQuery()
{

  // QString path="";
   QString path=QString("/%1/%2/%3/%4/%5").arg(resource).arg(MyGlobal::getMetodName(metodname)).arg(appid).arg(apppass).arg(parametersname);
   foreach (QString param, params.keys()) {

       path.replace("{"+param+"}",params[param].toString());

   }

    QUrl m_url(url);
    m_url.setPath(path);
    m_request.setUrl(m_url);
    m_request.setRawHeader("Content-Type","application/json;charset=utf-8");
  //  m_request.setRawHeader("SOAPAction","http://tempuri.org/IMobileClient/UserAuth");
    qDebug()&lt;&lt;m_url.url();


    return m_request;

}


QNetworkRequest HttpRequest::GenerateHTTPQueryPost()
{

  // QString path="";
   QString path=QString("/%1/%2").arg(resource).arg(MyGlobal::getMetodName(metodname));
    QUrl m_url(url);
    m_url.setPath(path);
    m_request.setUrl(m_url);
    m_request.setRawHeader("Content-Type","application/json;charset=utf-8");
  //  m_request.setRawHeader("SOAPAction","http://tempuri.org/IMobileClient/UserAuth");
    qDebug()&lt;&lt;m_url.url();


    return m_request;

}
</code></pre>