Bug 160656 - Segfault in XIM when using QSpinBox in sequential QApplications
Segfault in XIM when using QSpinBox in sequential QApplications
Product: Fedora
Classification: Fedora
Component: qt (Show other bugs)
i386 Linux
medium Severity low
: ---
: ---
Assigned To: Ngo Than
Ben Levenson
Depends On:
  Show dependency treegraph
Reported: 2005-06-16 09:41 EDT by Truls A. Tangstad
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-04-20 04:51:14 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Truls A. Tangstad 2005-06-16 09:41:28 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050524 Fedora/1.0.4-4 Firefox/1.0.4

Description of problem:
For unittesting purposes, it is important to be able to run each test within a new QApplication environment. Our usual procedure for running unittests have been to instanciate QApplication, run a single test, create a singleshot QTimer to end the exec-loop once it starts, start the exec loop of QApplication (which ends immediately), and finally delete the QApplication instance and repeat procedure for next test.

If we create a QSpinBox within such a test, and repeat the test twice, a segfault occurs on the second creation of QSpinBox, which the stack trace shows is due to a call to xim.

Usually we test using the python-bindings to Qt (which is how we discovered the problem), but it seems the problem is not related to these bindings but to Qt (or possibly xim).

This problem can not be reproduced on boxes running debian unstable with identical versions of qt.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Compile attached program using qmake -project, qmake, make (with correctly set QTDIR)


Actual Results:  Program prints:
doing it
doing it again
Segmentation fault

Expected Results:  It should have printed:
doing it
doing it again

Additional info:

Example program:

#include <qapplication.h>
#include <qspinbox.h>
#include <qtimer.h>
#include <stdio.h>

void create_app(int argc, char ** argv) {
  QApplication a( argc, argv );
  QSpinBox spinbox;
  QSpinBox spinbox2;
  QTimer::singleShot(0, &a, SLOT(quit()));

int main( int argc, char ** argv ) {
  printf("doing it\n");
  create_app(argc, argv);
  printf("doing it again\n");
  create_app(argc, argv);

Output from gdb:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208763936 (LWP 28719)]
0x0011f569 in _XGetWindowAttributes () from /usr/X11R6/lib/libX11.so.6
(gdb) bt
#0  0x0011f569 in _XGetWindowAttributes () from /usr/X11R6/lib/libX11.so.6
#1  0x0011f764 in XGetWindowAttributes () from /usr/X11R6/lib/libX11.so.6
#2  0x00ea94a1 in _XimLocalSetICValues () from /usr/X11R6/lib/X11/locale/lib/common/ximcp.so.2
#3  0x00eaa235 in _XimSetICDefaults () from /usr/X11R6/lib/X11/locale/lib/common/ximcp.so.2
#4  0x00eaa2cb in _XimSetICDefaults () from /usr/X11R6/lib/X11/locale/lib/common/ximcp.so.2
#5  0x00ea72db in _XimLocalCreateIC () from /usr/X11R6/lib/X11/locale/lib/common/ximcp.so.2
#6  0x0014e25a in XCreateIC () from /usr/X11R6/lib/libX11.so.6
#7  0x003cc60f in QXIMInputContext::setHolderWidget () from /usr/lib/qt-3.3/plugins/inputmethods/libqxim.so
#8  0x079a0e70 in QInputContextFactory::create () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#9  0x00abbe8d in QMultiInputContext::changeInputMethod () from /usr/lib/qt-3.3/plugins/inputmethods/libqimsw-multi.so
#10 0x00abc03e in QMultiInputContext::slave () from /usr/lib/qt-3.3/plugins/inputmethods/libqimsw-multi.so
#11 0x00abc2d9 in QMultiInputContext::setHolderWidget () from /usr/lib/qt-3.3/plugins/inputmethods/libqimsw-multi.so
#12 0x079a0e70 in QInputContextFactory::create () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#13 0x07703526 in QWidget::createInputContext () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#14 0x07703646 in QWidget::resetInputContext () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#15 0x0787e8ce in QLineEdit::setText () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#16 0x078d0a23 in QSpinBox::updateDisplay () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#17 0x078ce867 in QSpinBox::initSpinBox () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#18 0x078cef2d in QSpinBox::QSpinBox () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#19 0x0804c1b7 in create_app (argc=1, argv=0x1d4c28) at tester.cpp:8
#20 0x0804c298 in main (argc=1, argv=0xbf848754) at tester.cpp:18
Comment 1 Ngo Than 2005-06-16 10:39:50 EDT
I have tried your testcase on my test machine wih fc4. unfortunately i'm not
able to reproduce this problem. The testcase does not crash here!

Could you please try to find out how this crash has been caused on your system?

Comment 2 Truls A. Tangstad 2005-06-17 03:45:41 EDT
I have no idea what makes my system special, I have no special input methods set
up. Anything specific I might look for to try to debug this problem?
Comment 3 Ngo Than 2005-06-28 04:37:41 EDT
perhaps you should try with a new user. 

Note You need to log in before you can comment on or make changes to this bug.