×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    15

    Question qgraphicsview segmentation fault on Maemo since Qt4.7

    Hi,

    sorry if this is already posted but cannot find an answer.

    I am in the middle of creating my first C++/Qt mobile game using Qt Creator specifically at the moment for use on Maemo / N900.

    I have been developing and testing fine over past few months using Qt4.6. But then I updated Maemo to Pr1.3 and also Qt Creator using help/start updater to the latest versions of everything.

    But now although I can still run my app in the simulator fine it does not seem to work anymore on the device.

    I am getting a segmentation fault - and also this happens with a new project if I just add a graphicsview using the design mode and just go to run the app. straight away it will fail.

    Also others have this problem as here:
    http://talk.maemo.org/showthread.php?t=64518

    I have simple sample which will fail on the device:
    http://goostergames.com/bb2.zip

    I get these errors when debugging:

    Dump of assembler code for function _ZNK14QGraphicsScene9focusItemEv:
    0x41aa837c <+0>: push {r4, r5, r11, lr}
    0x41aa8380 <+4>: add r11, sp, #12
    0x41aa8384 <+8>: ldr r4, [r0, #4]
    0x41aa8388 <+12>: bl 0x41aa8054 <_ZNK14QGraphicsScene8isActiveEv>
    0x41aa838c <+16>: cmp r0, #0
    0x41aa8390 <+20>: ldrne r0, [r4, #184] ; 0xb8
    0x41aa8394 <+24>: ldreq r0, [r4, #188] ; 0xbc
    0x41aa8398 <+28>: pop {r4, r5, r11, pc}
    End of assembler dump.


    0 QGraphicsScene::focusItem() const c:/nokiaqtsdk/maemo/4.6.2/sysroots/fremantle-arm-sysroot-20.2010.36-2-slim/usr/lib/libQtGui.so.4 0 0x41aa8384
    1 ?? c:/nokiaqtsdk/maemo/4.6.2/sysroots/fremantle-arm-sysroot-20.2010.36-2-slim/usr/lib/libQtGui.so.4 0 0x41a62108
    2 ?? c:/nokiaqtsdk/maemo/4.6.2/sysroots/fremantle-arm-sysroot-20.2010.36-2-slim/usr/lib/libQtGui.so.4 0 0x41a62108

    Any help or clues much appreciated.

  2. #2
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: qgraphicsview segmentation fault on Maemo since Qt4.7

    Add scene to the view either in Qt Designer or manually in the code
    Code:
    ui->graphicsView->setScene(new QGraphicsScene(this));

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    15

    Re: qgraphicsview segmentation fault on Maemo since Qt4.7

    Thanks! you certainly pointed me on the right track.

    For anybody else interested in what I did I deleted the view from the ui form.

    then I created the vew in code and then added the scene to it, all in the MainWindow constructor.

    Like so:

    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);

    this->m_view = new QGraphicsView(this);
    this->m_view->setGeometry(0,0,800,400);

    scene = new myscene();
    scene->setSceneRect(0,0,SCENE_W,SCENE_H);
    scene->setBackgroundBrush(Qt::blue);
    this->m_view->setScene(this->scene);
    }

    (myscene is basically a QGraphicsScene subclassed to reimplement the mouse press event - but it works the same for a standard scene)

    ..still doesn't explain why it always worked the other way in 4.6 and still works on the simulator but not Qt 4.7 on Maemo anymore......anyway...it works now.

  4. #4
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: qgraphicsview segmentation fault on Maemo since Qt4.7

    Quote Originally Posted by shane_kiwi View Post
    ..still doesn't explain why it always worked the other way in 4.6 and still works on the simulator but not Qt 4.7 on Maemo anymore......anyway...it works now.
    Regression in 4.7.

Similar Threads

  1. Simple widget app getting segmentation fault..
    By mark77 in forum [Archived] Qt Mobility Project
    Replies: 37
    Last Post: 2010-11-27, 11:02
  2. Segmentation fault problem
    By NMMA in forum Qt
    Replies: 8
    Last Post: 2010-06-17, 11:53
  3. qt 4.6 /usr/lib vs /opt/qt4-maemo
    By romulovitor in forum Nokia N9
    Replies: 2
    Last Post: 2010-03-30, 19:01
  4. Replies: 1
    Last Post: 2010-03-13, 03:41

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×