Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 160656 - Segfault in XIM when using QSpinBox in sequential QApplications
Summary: Segfault in XIM when using QSpinBox in sequential QApplications
Alias: None
Product: Fedora
Classification: Fedora
Component: qt
Version: 4
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Ngo Than
QA Contact: Ben Levenson
Depends On:
TreeView+ depends on / blocked
Reported: 2005-06-16 13:41 UTC by Truls A. Tangstad
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2006-04-20 08:51:14 UTC

Attachments (Terms of Use)

Description Truls A. Tangstad 2005-06-16 13:41:28 UTC
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/
(gdb) bt
#0  0x0011f569 in _XGetWindowAttributes () from /usr/X11R6/lib/
#1  0x0011f764 in XGetWindowAttributes () from /usr/X11R6/lib/
#2  0x00ea94a1 in _XimLocalSetICValues () from /usr/X11R6/lib/X11/locale/lib/common/
#3  0x00eaa235 in _XimSetICDefaults () from /usr/X11R6/lib/X11/locale/lib/common/
#4  0x00eaa2cb in _XimSetICDefaults () from /usr/X11R6/lib/X11/locale/lib/common/
#5  0x00ea72db in _XimLocalCreateIC () from /usr/X11R6/lib/X11/locale/lib/common/
#6  0x0014e25a in XCreateIC () from /usr/X11R6/lib/
#7  0x003cc60f in QXIMInputContext::setHolderWidget () from /usr/lib/qt-3.3/plugins/inputmethods/
#8  0x079a0e70 in QInputContextFactory::create () from /usr/lib/qt-3.3/lib/
#9  0x00abbe8d in QMultiInputContext::changeInputMethod () from /usr/lib/qt-3.3/plugins/inputmethods/
#10 0x00abc03e in QMultiInputContext::slave () from /usr/lib/qt-3.3/plugins/inputmethods/
#11 0x00abc2d9 in QMultiInputContext::setHolderWidget () from /usr/lib/qt-3.3/plugins/inputmethods/
#12 0x079a0e70 in QInputContextFactory::create () from /usr/lib/qt-3.3/lib/
#13 0x07703526 in QWidget::createInputContext () from /usr/lib/qt-3.3/lib/
#14 0x07703646 in QWidget::resetInputContext () from /usr/lib/qt-3.3/lib/
#15 0x0787e8ce in QLineEdit::setText () from /usr/lib/qt-3.3/lib/
#16 0x078d0a23 in QSpinBox::updateDisplay () from /usr/lib/qt-3.3/lib/
#17 0x078ce867 in QSpinBox::initSpinBox () from /usr/lib/qt-3.3/lib/
#18 0x078cef2d in QSpinBox::QSpinBox () from /usr/lib/qt-3.3/lib/
#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 14:39:50 UTC
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 07:45:41 UTC
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 08:37:41 UTC
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.