PDA

View Full Version : Segfault in Construkctor of QCoreApplication?!?



schulze
5th November 2008, 15:42
Maybe I'm doing something fundamentally wrong ...

I'm working under Ubuntu 8.04 Desktop on an IBM R52 laptop in an open-source project named "fingerprint GUI" using Qt4 for the development of the user interface. The project is aimed to enable login and PAM authentication using fingerprint sensor devices on Linux. Significant parts of the project work already. You can find the project on "http://www.pdfserver.net/fingerprint".

How it works (For those who are not familiar with PAM):
If e.g. a fingerprint login is required, the Gnome display manager "GDM" calls
the PAM library "libpam.so" for authentication of the user. Depending on the PAM configuration in "/etc/pam.d" libpam.so calls the PAM module (in my case
libpam_fingerprint.so) and waits for user authentication. this "libpam_fingerprint.so" is part of my project. It activates a QtDialog and urges the user to identify with his fingerprint.

Now to my problem:
While various applications such as GDM, su, sudo and gksu work fine, it comes in case of "gnome-screensaver" to a "SegFault" if the QCoreApplication object is initialized (entry in /var/log/syslog):
"gnome-screensav[14369]: segfault at 00000008 eip b68702cf esp bf982130 error 4"

This happens _always_ in line 457 of qcoreapplication.cpp. This is the relevant part in qcoreapplication.cpp:



// ### move to QCoreApplicationPrivate constructor?
void QCoreApplication::init()
{
Q_D(QCoreApplication);

#ifdef Q_OS_UNIX
setlocale(LC_ALL, ""); // use correct char set mapping
setlocale(LC_NUMERIC, "C"); // make sprintf()/scanf() work
#endif

#ifdef Q_WS_WIN
// Get the application name/instance if qWinMain() was not invoked
set_winapp_name();
#endif

Q_ASSERT_X(!self, "QCoreApplication", "there should be only one application object");
QCoreApplication::self = this;

#ifndef QT_NO_THREAD
QThread::initialize();
#endif

// use the event dispatcher created by the app programmer (if any)
if (!QCoreApplicationPrivate::eventDispatcher)
QCoreApplicationPrivate::eventDispatcher = d->threadData->eventDispatcher;
// otherwise we create one
if (!QCoreApplicationPrivate::eventDispatcher)
d->createEventDispatcher(); //HERE IT HAPPENS !!!!!!!!!!
Q_ASSERT(QCoreApplicationPrivate::eventDispatcher != 0);


I can reproduce this behavior with gnome-screensaver 2.22.2 and 2.20.x as well as with Qt version 4.3.4-0 (Ubuntu) and 4.4.3 (from qt-x11-opensource-src-4.4.3).

In order to proof the error is not caused by my "libpam_fingerprint.so" I have built a very simple "libpam_dummy.so" library to be used with PAM. It creates a simple QDialog when called by PAM and returns PAM_SUCCESS on close. The sources I have attached here in file "pam_dummy.tar.gz". This simple module library causes _always_ the same segfault in the same line 457 of qcoreapplication.cpp as well.

Now I don't have any idea about how to fix this. Either I'm doing something completely wrong or there is a bug in gnome-screensaver or in Qt. If anyone can help to find out what happens please have a look at it.

Thanks for any advice!

W.U.

schulze
6th November 2008, 12:50
...nobody any ideas??

W.U.