Results 1 to 7 of 7

Thread: QWidget::show () segmentation fault

  1. #1
    Join Date
    Sep 2007
    Posts
    4
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default QWidget::show () segmentation fault

    Hi all,

    I am using Qt3 to develop GUI program. In my program, I provide some toolbars and when user click on it, a window will pop up. But there is a strange behaviour happened. When I clicked on the toolbar, the program crashed and showed "segmentation fault" error. By using gdb, I found out that this happened whenever QWidget::show() executed.

    The error happened when I use Qt3 library from my own compilation and running on Debian etch. When I use the Qt3 library provided by Debian Etch, the problem occurred occasionally and unpredictable. But when I use Qt3 library from my own compilation and running on Ubuntu Breezy, the error never occurred.

    Has anyone experience problem like mine? Any hints will be appreciated.

    Umar Said

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QWidget::show () segmentation fault

    What else happens when the widget is shown?
    You should post some code.
    Make sure you don't modify that widget from other threads.

  3. #3
    Join Date
    Sep 2007
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QWidget::show () segmentation fault

    When I was coding on two distros, I made sure that the versions and releases are the same. If there is a difference, even a slight difference, I usually recreate project and rebuild project. You also need to check the documentation of the two, there may be changes, and your implementation somehow causes the segmentation fault.

  4. #4
    Join Date
    Sep 2007
    Posts
    4
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: QWidget::show () segmentation fault

    Thanks very much for all your reply.

    I intended to put an attachment of my source in tar.bz2, but due to my very very bad internet connection, I post them here. Sorry for the long codes.

    The main problem is displaying dialog CreateHull.ui when I click on a toolbar. Below is the source code of it. I hope you can reproduce the error. Maybe later when my internet connection get better, I will attach the source in tar.bz2 format.

    I compile and run the code in two different computer. One on Debian Etch using libqt3-mt 3.3.7-4 and gcc version 3.3.6, while the other on Ubuntu Breezy using my own compiled qt3 3.3.7 and gcc 4.0.2. The program run normal on Ubuntu, when I click the toolbar, the CreateHull dialog pop up. But when I run the same program on Debian, the program exited with segmentation error.

    CreateHullBase.ui
    Qt Code:
    1. <!DOCTYPE UI><UI version="3.3" stdsetdef="1">
    2. <class>CreateHullBase</class>
    3. <widget class="QDialog">
    4. <property name="name">
    5. <cstring>CreateHullBase</cstring>
    6. </property>
    7. <property name="geometry">
    8. <rect>
    9. <x>0</x>
    10. <y>0</y>
    11. <width>201</width>
    12. <height>122</height>
    13. </rect>
    14. </property>
    15. <property name="caption">
    16. <string>Outer Hull</string>
    17. </property>
    18. <property name="icon">
    19. <pixmap>image0</pixmap>
    20. </property>
    21. <grid>
    22. <property name="name">
    23. <cstring>unnamed</cstring>
    24. </property>
    25. <widget class="QLayoutWidget" row="0" column="0">
    26. <property name="name">
    27. <cstring>layout7</cstring>
    28. </property>
    29. <grid>
    30. <property name="name">
    31. <cstring>unnamed</cstring>
    32. </property>
    33. <widget class="QLineEdit" row="0" column="1">
    34. <property name="name">
    35. <cstring>txtBreadth</cstring>
    36. </property>
    37. </widget>
    38. <widget class="QLineEdit" row="1" column="1">
    39. <property name="name">
    40. <cstring>txtDepth</cstring>
    41. </property>
    42. </widget>
    43. <widget class="QLabel" row="0" column="0">
    44. <property name="name">
    45. <cstring>textLabel1</cstring>
    46. </property>
    47. <property name="text">
    48. <string>Breadth :</string>
    49. </property>
    50. </widget>
    51. <widget class="QLabel" row="1" column="0">
    52. <property name="name">
    53. <cstring>textLabel2</cstring>
    54. </property>
    55. <property name="text">
    56. <string>Depth :</string>
    57. </property>
    58. </widget>
    59. </grid>
    60. </widget>
    61. <spacer row="1" column="0">
    62. <property name="name">
    63. <cstring>spacer6</cstring>
    64. </property>
    65. <property name="orientation">
    66. <enum>Vertical</enum>
    67. </property>
    68. <property name="sizeType">
    69. <enum>Expanding</enum>
    70. </property>
    71. <property name="sizeHint">
    72. <size>
    73. <width>20</width>
    74. <height>20</height>
    75. </size>
    76. </property>
    77. </spacer>
    78. <widget class="QLayoutWidget" row="2" column="0">
    79. <property name="name">
    80. <cstring>layout8</cstring>
    81. </property>
    82. <hbox>
    83. <property name="name">
    84. <cstring>unnamed</cstring>
    85. </property>
    86. <spacer>
    87. <property name="name">
    88. <cstring>spacer7</cstring>
    89. </property>
    90. <property name="orientation">
    91. <enum>Horizontal</enum>
    92. </property>
    93. <property name="sizeType">
    94. <enum>Expanding</enum>
    95. </property>
    96. <property name="sizeHint">
    97. <size>
    98. <width>20</width>
    99. <height>20</height>
    100. </size>
    101. </property>
    102. </spacer>
    103. <widget class="QPushButton">
    104. <property name="name">
    105. <cstring>btnCreate</cstring>
    106. </property>
    107. <property name="text">
    108. <string>&amp;Create</string>
    109. </property>
    110. <property name="accel">
    111. <string>Alt+C</string>
    112. </property>
    113. </widget>
    114. <widget class="QPushButton">
    115. <property name="name">
    116. <cstring>btnClose</cstring>
    117. </property>
    118. <property name="text">
    119. <string>Close</string>
    120. </property>
    121. </widget>
    122. </hbox>
    123. </widget>
    124. </grid>
    125. </widget>
    126. <images>
    127. <image name="image0">
    128. <data format="PNG" length="477">89504e470d0a1a0a0000000d49484452000000100000001008060000001ff3ff61000001a449444154789c9d9331481b6118869f8bcde19004940e1d345320d2e51c6d860ec5160411a4a4118a09073786cc0117c9e2261a220ebd9fd0a11a101c840ca90856316d37bb58d2de620669d586a61789e291eb76782647b5dff4bfffffbecffff1c12701944a25bbd56a71dfd2344d92745db763b1189148e45e61c330a856abf800cfb01002455190651945511042605916ed76dbc93cf0fa4108c1d6c612d5f72bc8721fed8bdfcc6a592ccb22994c3a3e9f17209fcfb3f67685bece4fae7e7dc077f985d585690a8582cbe77420cb72176460789cc6d1bca343c17e6ab55a6f00c08f3915eba4eee8a1e20e838fe779579861e2d9087fcc4ba2d1a837c03aa9737dfcdd65d8fb74c8d3b151b6d73516dfec934ea75def9e3300c8e5727cfe7606402677c0e4cb0ca954ea6e8062bdc9f3a9579c364cd4ec32e170185555bb7c9e80f317aff97adc00e0e1a3612a950ae572b9cbe79ac15071c7397f5cccb0b97be46835bb4c3c1ea7d96cf606dcdc854020c093d111afe67a036cdb762e4dd3ec69ee743a00f8fd7e37c0308cff5aa650288404a0ebbafdafc0ed0a0683241209e92f6d219098fc3e299c0000000049454e44ae426082</data>
    129. </image>
    130. </images>
    131. <connections>
    132. <connection>
    133. <sender>btnClose</sender>
    134. <signal>clicked()</signal>
    135. <receiver>CreateHullBase</receiver>
    136. <slot>accept()</slot>
    137. </connection>
    138. </connections>
    139. <layoutdefaults spacing="6" margin="11"/>
    140. </UI>
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QWidget::show () segmentation fault

    Could we see the relevant code (not the designed form)? Or run it through a debugger and see backtrace where exactly does it crash.
    J-P Nurmi

  6. #6
    Join Date
    Sep 2007
    Posts
    4
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: QWidget::show () segmentation fault

    I have attached the source code. When I compile it using debug config, the backtrace output is below (truncated).

    Qt Code:
    1. (gdb) bt
    2. #0 0x0809d77f in ?? ()
    3. #1 0x0804d954 in MainWindow::editFind (this=0x8080de8)
    4. at src/MainWindow.cpp:24
    5. #2 0x08055556 in MainWindowBase::qt_invoke (this=0x8080de8, _id=72,
    6. _o=0xbf88858c) at .moc/moc_MainWindowBase.cpp:123
    7. #3 0x08054a17 in MainWindow::qt_invoke (this=0x8080de8, _id=72, _o=0xbf88858c)
    8. at .moc/moc_MainWindow.cpp:77
    9. #4 0xb7a41d4f in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
    10. #5 0xb7a427e0 in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
    11. #6 0xb7df33ea in QAction::activated () from /usr/lib/libqt-mt.so.3
    12. #7 0xb7baad51 in QAction::internalActivation () from /usr/lib/libqt-mt.so.3
    13. #8 0xb7df3152 in QAction::qt_invoke () from /usr/lib/libqt-mt.so.3
    14. #9 0xb7a41d4f in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
    15. #10 0xb7dcaee3 in QSignal::signal () from /usr/lib/libqt-mt.so.3
    To copy to clipboard, switch view to plain text mode 

    Actually, I also found this kind of error about a year ago when beginning to use Qt. It also happened in Debian Etch. When I compile it, a warning appeared.

    Qt Code:
    1. /usr/bin/ld: warning: libstdc++.so.6, needed by /usr/share/qt3/lib/libqt-mt.so, may conflict with libstdc++.so.5
    To copy to clipboard, switch view to plain text mode 
    Attached Files Attached Files

  7. #7
    Join Date
    Sep 2007
    Posts
    4
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: QWidget::show () segmentation fault

    I've just find out that on Ubuntu Feisty (7.10), the code also generated error. The Qt I used is libqt3-mt 3.3.8really3.3.7-0ubuntu5.2. Is this Linux or Qt issue? Anybody willing to try it?

Similar Threads

  1. Segmentation Fault
    By Krish_ng in forum Qt Programming
    Replies: 8
    Last Post: 7th August 2007, 10:49
  2. Process aborted. Segmentation fault
    By Pragya in forum Qt Programming
    Replies: 3
    Last Post: 30th May 2007, 08:12
  3. Replies: 2
    Last Post: 19th May 2007, 18:25
  4. Segmentation fault running any QT4 executables
    By jellis in forum Installation and Deployment
    Replies: 7
    Last Post: 19th May 2007, 16:35
  5. Icons missing => segmentation fault
    By antonio.r.tome in forum Qt Programming
    Replies: 4
    Last Post: 8th March 2006, 16:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.