exited with code -1073741819



  • Hello, I have a problem with my application, after some time, after about 7 seconds the application stops running, my code:

    .pro

    TEMPLATE = app
    CONFIG += c++11
    CONFIG -= app_bundle
    CONFIG -= console
    QT += network core widgets gui webkit webkitwidgets qml quick
    SOURCES += main.cpp \
        variable.cpp \
    
    
    HEADERS += \
        yei_threespace_api.h \
        variable.h \
    
    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/ThreeSpace_API_C_2.0.6.1/ -lThreeSpace_API
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/ThreeSpace_API_C_2.0.6.1/ -lThreeSpace_APId
    else:unix: LIBS += -L$$PWD/ThreeSpace_API_C_2.0.6.1/ -lThreeSpace_API
    
    INCLUDEPATH += $$PWD/ThreeSpace_API_C_2.0.6.1
    DEPENDPATH += $$PWD/ThreeSpace_API_C_2.0.6.1
    

    .variable.cpp

    #include "variable.h"
    #include "yei_threespace_api.h"
    #include <QDebug>
    #include <math.h>
    
    
    Variable::Variable(QObject *parent) :
        QObject(parent)
    {
    
    timer = new QTimer(this);
    connect(timer,SIGNAL(timeout()),this,SLOT(enviar()));
    timer->start(125);
    }
    
    void Variable::enviar()
    {
        //obtener valores del sensor
            TSS_Device_Id  device;
            TSS_Error tss_error;
            TSS_ComPort comport;
    
            if(tss_getComPorts(&comport,1,0,TSS_FIND_ALL_KNOWN^TSS_FIND_DNG)){
                device =tss_createTSDeviceStr(comport.com_port, TSS_TIMESTAMP_SENSOR);
                if( device == TSS_NO_DEVICE_ID){
                    qDebug() << "Failed to create a sensor on %s\n";
                }
            }
            else{
              qDebug() << "No sensors found";
    
            }
    
            float quat[4];
            unsigned int timestamp;
            tss_error= tss_getTaredOrientationAsQuaternion(device, quat, &timestamp);
            if(tss_error){
               qDebug() <<"TSS_Error: %s\n";
            }
    
            float gyro[3];
            float accel[3];
            float compass[3];
            tss_error= tss_getAllCorrectedComponentSensorData(device, gyro, accel, compass, NULL);
            if(tss_error){
             qDebug() << "TSS_Error: %s\n";
            }
            tss_closeTSDevice(device);
    
            float x = quat[0];
            float y = quat[1];
            float z = quat[2];
            float w = quat[3];
    
    float roll = atan2( 2 * y * w -  2 * x * z ,  1  -  2 * y * y -  2 * z * z );
    float pitch =  atan2( 2 * x * w -  2 * y * z ,  1  -  2 * x * x -  2 * z * z );
    float yaw = asin ( 2 * x * y +  2 * z * w );
        roll = roll;
        pitch = pitch;
        yaw = yaw;
        QString rol = QString::number(roll);
        QString pitc = QString::number(pitch);
        QString ya = QString::number(yaw);
    
        //envio De los datos
        QNetworkRequest requerimiento(QUrl("http://127.0.0.1/vidas/envio.php"));
        QByteArray postDatos;
        QUrlQuery consulta;
        consulta.addQueryItem("roll",rol);
        consulta.addQueryItem("pitch",pitc);
        consulta.addQueryItem("yaw",ya);
        postDatos.append(consulta.toString());
        requerimiento.setHeader(QNetworkRequest::ContentTypeHeader,"application/x-www-form-urlencoded;charset=UTF-8");
        requerimiento.setHeader(QNetworkRequest::ContentLengthHeader,postDatos.length());
    
        man = new QNetworkAccessManager(this);
        man->post(requerimiento,postDatos);
    
    
    
    }
    
    

    variable.h

    #ifndef VARIABLE_H
    #define VARIABLE_H
    
    #include <QObject>
    #include <QNetworkAccessManager>
    #include <QNetworkRequest>
    #include <QNetworkReply>
    #include <QUrlQuery>
    #include <QDateTime>
    #include <QFile>
    #include <QDebug>
    #include <QProcess>
    #include <QEventLoop>
    #include <QTextStream>
    #include <QTimer>
    
    class Variable : public QObject
    {
     Q_OBJECT
    public:
        explicit Variable(QObject *parent = 0);
    
    public slots:
        void replyFinished (QNetworkReply *reply);
        void enviar();
    
    private:
       QNetworkAccessManager *man;
       QNetworkReply *resp;
       QProcess *proc;
       QTimer *timer;
    };
    
    #endif // VARIABLE_H
    

    main.cpp

    #include "variable.h"
    #include <QApplication>
    
    int main(int argc, char **argv)
    {
    QApplication app(argc, argv);
    Variable d;
    return app.exec();
    }
    
    

    envio.php

    <?php
        $fd = fopen("datos.txt","w");
        fwrite($fd, $_POST["roll"].",");
        fwrite($fd, $_POST["pitch"].",");
        fwrite($fd, $_POST["yaw"]);
        fclose($fd);
    
    ?>
    
    

    Someone who can help me please.


  • Lifetime Qt Champion

    Hi,

    One thing I can see is that you are filling up your memory with QNetworkAccessManager objects since you recreate it each time you call enviar.



  • @SGaist hi thanks for reply,You are right, but it is also for every by creating a sensor contact that stupid I am, thank you very much:D


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.