Search code examples
qtqglwidgetqlist

QList for touch-points not being created, "A data abort exception has occurred"


I am trying to get touch inputs for my program targeting an N8 (and a C7), and I am not able to create a QList for keeping touchpoints using QTouchEvent::touchPoints(). The program crashes with the following line: Thread has crashed: A data abort exception has occurred accessing 0xee

The overloaded events function looks like:

bool GLWindow::event(QEvent *event)
{
    switch ( event->type() ) {
        case QEvent::TouchBegin: {
            QList<QTouchEvent::TouchPoint> touchBeginPoints =
                        static_cast<QTouchEvent *>(event)->touchPoints();
            foreach (const QTouchEvent::TouchPoint &touchBeginPoint, touchBeginPoints)
            {
                float touchBeginX = touchBeginPoint.pos().x();
                float touchBeginY = touchBeginPoint.pos().y();
                qDebug() << "touchBeginPoint := " << touchBeginX << ",  " << touchBeginY;
            }
            break;
        }
        case QEvent::TouchUpdate: {
            // same as touch begin: getting touch point
            break;
        }
        case QEvent::TouchEnd: {
            // same as touch begin: getting touch point
            break;
        }
        default: {
            qDebug() << "Goodbye";
           return true;
        }
    }
    return true;
}

Now,

  • I have never worked with containers before. But creating and using a QList in another part of the program works fine. Should I be including something in my .pro file? (Most problems seem to end up regarding this with me!)
  • I read (a bit) about exceptions in Qt and Symbian, but I am not able to get most of that. BUT I am not doing any networking or resource based i/o or manipulation except textures for 3D objects. Is it possible that memory allocation while running the program is creating some problem?

Basically I am just trying to print the touch point. But I am clueless as to why I can’t create a QList. The code compiles fine. I tried my best (unsuccessfully), but is there any other way to get the screen coordinates of a touchpoint (one that does not require a QList)? Any comments are welcome.

[Reposting from qt-project.org.]


Solution

  • Your syntax is 100% correct. Just look at this example: http://www.developer.nokia.com/Community/Wiki/Painting_in_Qt

    What I'm guessing happens is that QTouchEvent::touchPoints() returns a list big enough that it overflows your stack. Try increasing the stack size for your application.