Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] debug error r6010 abort has been called while running perfectly
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] debug error r6010 abort has been called while running perfectly

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 16.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    habbas33
    wrote on last edited by
    #1

    I am trying to generate QWTspectrogram using a file. there are 500 binary files to show an annimation with a slider in UI. the program works fine but sometimes it gives "debug error r6010 abort has been called" error and crashes on any random occasion I have no idea why this shows up because it is random however it depends on the change in fnum as slider moves but not at any fixed value or time(it does not appear at stationary condition). below is the code for my program

    setAlpha is changed with the change in slider of UI.

    @ void Plot::setAlpha( int alpha )

    {
    
        fnum=alpha;
    
        d_spectrogram->setData( new mydata(fnum,dial) );
    
        d_spectrogram->attach( this );
    
        replot();
    
    }
    
    
    class mydata: public QwtRasterData
    
    {
    
        typedef signed short int sBYTE;
    
        char filepath[35]; 
    
        sBYTE *fileBuf;    
    
        FILE *file = NULL; 
    
    public:
    
    
    
    mydata(int fnum, int dial)
    
        {
    
        setInterval( Qt::XAxis, QwtInterval( 0, (area)-1 ) );
    
        setInterval( Qt::YAxis, QwtInterval( 0, (area)-1 ) );
    
        setInterval( Qt::ZAxis, QwtInterval( -dial, dial ) );
    
    
    
        {
    
             sprintf_s(filepath, "c:/mydata/dfile%d.bin", fnum);
    
             fopen_s(&file,filepath, "rb");
    
             long fileSize = getFileSizex(file);
    
             fileBuf = new sBYTE[fileSize];
    
             fread(fileBuf, fileSize, 1, file);
    
             fclose(file);
    
    
         }
    
        }
    
        virtual double value( double x, double y ) const
    
        {
    
    
    
        int x_pos = static_cast<int>(x);
    
        int y_pos = static_cast<int>(y);
    
        const double c =  (fileBuf[ ((x_pos)+((area-y_pos)*area))]);
    
        return c;
    
        }
    

    }@

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tilsitt
      wrote on last edited by
      #2

      Hi,

      It looks like you have an uncaught exception. Have you tried to catch it?

      1 Reply Last reply
      0
      • H Offline
        H Offline
        habbas33
        wrote on last edited by
        #3

        i am new to c++ and really dont know what it means. please guide how to track it.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tilsitt
          wrote on last edited by
          #4

          If you're new to exceptions in c++, you should read the following "tutorial":http://www.cplusplus.com/doc/tutorial/exceptions/.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi,

            Also, since you are using Qt, why don't you make use of QString/QFile/QByteArray ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • H Offline
              H Offline
              habbas33
              wrote on last edited by
              #6

              thank you SGiast :) it is working now

              QFile myfile;
              myfile.setFileName("c:/file.bin");
              if(!myfile.open(QIODevice::ReadOnly)) return;

              QDataStream data(&myfile);
              data.setByteOrder(QDataStream::LittleEndian);
              QVector<qint16> result;
              while(!data.atEnd()) {
              qint16 x;
              data >> x;
              result.append(x);
              }

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved