×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    3

    Custom Widgets create seg-fault

    Currently I am in the process of creating custom Qt widgets for the nokia n900. However, whenever I compile even a completely vanilla widget such as the one below:
    Code:
    #ifndef HOME_WIDGET_H
    #define HOME_WIDGET_H
    
    #include <QWidget>
    #include "app_page_widget.h"
    
    class Home_Widget : public QWidget
    {
       Q_OBJECT
    
    public:
       Home_Widget(QWidget * parent = 0);
    
    private:
    
    
    protected:
    
    
    public slots:
    
    };
    
    #endif
    and implement it using:
    Code:
       QApplication qapp(argc, argv);
    
       
       home_widget = new Home_Widget();
    
    
    
       label = new QLabel("test label");
    
       
       qapp.exec();
    I get a segfault. Note that the segfault occurs any time I merely create the widget, it doesn't matter whether I actually show it or not. Running identical code on my x86 debian system produces no such segfault.

    Here is the backtrace:

    Code:
    Program received signal SIGSEGV, Segmentation fault.
    0x444197bc in QMetaObject::cast(QObject*) const () from /usr/lib/libQtCore.so.4
    0x444197bc <_ZNK11QMetaObject4castEP7QObject+56>:	ldr	r0, [r0]
    (gdb) bt
    #0  0x444197bc in QMetaObject::cast(QObject*) const ()
       from /usr/lib/libQtCore.so.4
    #1  0x4056eb1c in QWindowsStyle::polish(QWidget*) ()
       from /usr/lib/libQtGui.so.4
    #2  0x40551770 in QCleanlooksStyle::polish(QWidget*) ()
       from /usr/lib/libQtGui.so.4
    #3  0x40531cd8 in QGtkStyle::polish(QWidget*) () from /usr/lib/libQtGui.so.4
    #4  0x40549970 in QHildonStyle::polish(QWidget*) () from /usr/lib/libQtGui.so.4
    #5  0x401cf234 in QWidget::event(QEvent*) () from /usr/lib/libQtGui.so.4
    #6  0x4016cefc in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
       from /usr/lib/libQtGui.so.4
    #7  0x4016d040 in QApplication::notify(QObject*, QEvent*) ()
       from /usr/lib/libQtGui.so.4
    #8  0x444116d8 in QCoreApplication::notifyInternal(QObject*, QEvent*) ()
       from /usr/lib/libQtCore.so.4
    #9  0x401bed90 in QWidget::ensurePolished() const ()
       from /usr/lib/libQtGui.so.4
    #10 0x401cf2ec in QWidget::event(QEvent*) () from /usr/lib/libQtGui.so.4
    #11 0x4016cefc in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
       from /usr/lib/libQtGui.so.4
    #12 0x4016d040 in QApplication::notify(QObject*, QEvent*) ()
       from /usr/lib/libQtGui.so.4
    #13 0x444116d8 in QCoreApplication::notifyInternal(QObject*, QEvent*) ()
    Could someone please explain if there is some sort of special macro or widget I need to subclass in order to avoid these segfaults? I've even tried custom widgets out of the book <i>C++ GUI programming with Qt 4</i> and these give segfaults whilst running fine on x86.

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

    Re: Custom Widgets create seg-fault

    Please, show also an implementation of the widget. What is version of Qt in your development environment and on N900 device.

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    3

    Re: Custom Widgets create seg-fault

    Implementation is as shown, it's just a blank class that inherits from QWidget with an empty constructor. development is Qt version 4.6.2, nokia n900 device is on 4.5.3.

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

    Re: Custom Widgets create seg-fault

    Quote Originally Posted by w2null View Post
    Implementation is as shown, it's just a blank class that inherits from QWidget with an empty constructor.
    Empty constructor looks like this:
    Code:
    Home_Widget(QWidget *parent) : QWidget(parent)
    {
    }
    Quote Originally Posted by w2null View Post
    development is Qt version 4.6.2, nokia n900 device is on 4.5.3.
    4.6.2 and 4.5.3 are binary incompatible, that's why you have a crash. Install Qt 4.6.2 on the device (it's in Fremantle repository
    http://repository.maemo.org/pool/fre...ree/q/qt4-x11/) or downgrade Qt in your development environment.

  5. #5
    Registered User
    Join Date
    May 2010
    Posts
    3

    Re: Custom Widgets create seg-fault

    This was indeed the problem, thanks for your help!

Similar Threads

  1. How to create custom SIP header fields in S60 3rd edition
    By murkyl in forum Symbian Networking & Messaging (Closed)
    Replies: 3
    Last Post: 2006-03-21, 21:13
  2. create custom screensaver.sis file?
    By keymistress in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2005-06-07, 05:42
  3. How to create a custom control
    By alok_bbk in forum Symbian User Interface
    Replies: 1
    Last Post: 2004-10-18, 05:42
  4. Replies: 9
    Last Post: 2004-09-12, 10:08
  5. How to create CEikEdwin Custom Drawer?
    By atchariya in forum Symbian
    Replies: 0
    Last Post: 2003-12-06, 12:25

Posting Permissions

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