From 65f2273f43bfca718ee51e8d491c76ef830238f7 Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Fri, 18 Jun 2010 17:24:18 +0200 Subject: Debug prints and another attempt to fix QTBUG-8687 for N8. --- src/network/kernel/qhostinfo_unix.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/network/kernel/qhostinfo_unix.cpp b/src/network/kernel/qhostinfo_unix.cpp index df98d5d..79f4b9b 100644 --- a/src/network/kernel/qhostinfo_unix.cpp +++ b/src/network/kernel/qhostinfo_unix.cpp @@ -208,12 +208,19 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName) #ifdef Q_ADDRCONFIG hints.ai_flags = Q_ADDRCONFIG; #endif +#ifdef Q_OS_SYMBIAN + qDebug() << "Setting flags: 'hints.ai_flags &= AI_V4MAPPED | AI_ALL'"; +#endif int result = getaddrinfo(aceHostname.constData(), 0, &hints, &res); # ifdef Q_ADDRCONFIG if (result == EAI_BADFLAGS) { // if the lookup failed with AI_ADDRCONFIG set, try again without it hints.ai_flags = 0; +#ifdef Q_OS_SYMBIAN + qDebug() << "Setting flags: 'hints.ai_flags &= AI_V4MAPPED | AI_ALL'"; + hints.ai_flags &= AI_V4MAPPED | AI_ALL; +#endif result = getaddrinfo(aceHostname.constData(), 0, &hints, &res); } # endif @@ -222,6 +229,8 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName) addrinfo *node = res; QList addresses; while (node) { + qDebug() << "getaddrinfo node: flags:" << node->ai_flags << "family:" << node->ai_family << "ai_socktype:" << node->ai_socktype << "ai_protocol:" << node->ai_protocol << "ai_addrlen:" << node->ai_addrlen; + if (node->ai_family == AF_INET) { QHostAddress addr; addr.setAddress(ntohl(((sockaddr_in *) node->ai_addr)->sin_addr.s_addr)); -- cgit v0.12 From 2ee850be142dbdc47ba9611c94cd9bd47792a67a Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Fri, 18 Jun 2010 17:25:56 +0200 Subject: Fix QTBUG-8687. The fix is based on 9897aece975e0a4a77e0cc6b8590305baba1fccb. Task-number: QTBUG-8687 Reviewed-by: TrustMe --- src/network/kernel/qhostinfo_unix.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/network/kernel/qhostinfo_unix.cpp b/src/network/kernel/qhostinfo_unix.cpp index 79f4b9b..9139816 100644 --- a/src/network/kernel/qhostinfo_unix.cpp +++ b/src/network/kernel/qhostinfo_unix.cpp @@ -209,7 +209,9 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName) hints.ai_flags = Q_ADDRCONFIG; #endif #ifdef Q_OS_SYMBIAN - qDebug() << "Setting flags: 'hints.ai_flags &= AI_V4MAPPED | AI_ALL'"; +# ifdef QHOSTINFO_DEBUG + qDebug() << "Setting flags: 'hints.ai_flags &= AI_V4MAPPED | AI_ALL'"; +# endif #endif int result = getaddrinfo(aceHostname.constData(), 0, &hints, &res); @@ -218,7 +220,9 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName) // if the lookup failed with AI_ADDRCONFIG set, try again without it hints.ai_flags = 0; #ifdef Q_OS_SYMBIAN +# ifdef QHOSTINFO_DEBUG qDebug() << "Setting flags: 'hints.ai_flags &= AI_V4MAPPED | AI_ALL'"; +# endif hints.ai_flags &= AI_V4MAPPED | AI_ALL; #endif result = getaddrinfo(aceHostname.constData(), 0, &hints, &res); @@ -229,8 +233,9 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName) addrinfo *node = res; QList addresses; while (node) { - qDebug() << "getaddrinfo node: flags:" << node->ai_flags << "family:" << node->ai_family << "ai_socktype:" << node->ai_socktype << "ai_protocol:" << node->ai_protocol << "ai_addrlen:" << node->ai_addrlen; - +#ifdef QHOSTINFO_DEBUG + qDebug() << "getaddrinfo node: flags:" << node->ai_flags << "family:" << node->ai_family << "ai_socktype:" << node->ai_socktype << "ai_protocol:" << node->ai_protocol << "ai_addrlen:" << node->ai_addrlen; +#endif if (node->ai_family == AF_INET) { QHostAddress addr; addr.setAddress(ntohl(((sockaddr_in *) node->ai_addr)->sin_addr.s_addr)); -- cgit v0.12 From 074aaf9901567c9c66eeca20514c78419e2016bb Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Sun, 20 Jun 2010 13:08:22 +0200 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( be1a105be93d7fcbe36d93d0827dc6e98b55de0c ) Changes in WebKit/qt since the last update: * https://bugs.webkit.org/show_bug.cgi?id=40567 -- [Qt] QtWebKit crashes while initializing flash plugin 10.1.53.64. --- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 13 ++++++++++++ .../webkit/WebCore/plugins/qt/PluginPackageQt.cpp | 23 ++++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 482982d..1b8e789 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - a13977ce2aba31808a046cddc082a84dc316d78b + be1a105be93d7fcbe36d93d0827dc6e98b55de0c diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 63af196..8a75d6b 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,16 @@ +2010-06-16 Dawit Alemayehu + + Reviewed by Simon Hausmann. + + [Qt] QtWebKit crashes while initializing flash plugin 10.1.53.64. + https://bugs.webkit.org/show_bug.cgi?id=40567 + + Avoid preventable crashes by ensuring gtk_init() is called in the + flash viewer plugins before calling NP_Initialize. + + * plugins/qt/PluginPackageQt.cpp: + (WebCore::PluginPackage::load): + 2010-06-10 Raine Makelainen Reviewed by Kenneth Rohde Christiansen. diff --git a/src/3rdparty/webkit/WebCore/plugins/qt/PluginPackageQt.cpp b/src/3rdparty/webkit/WebCore/plugins/qt/PluginPackageQt.cpp index 8119924..4ff520b 100644 --- a/src/3rdparty/webkit/WebCore/plugins/qt/PluginPackageQt.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/qt/PluginPackageQt.cpp @@ -35,6 +35,8 @@ namespace WebCore { +typedef void gtkInitFunc(int *argc, char ***argv); + bool PluginPackage::fetchInfo() { if (!load()) @@ -109,6 +111,7 @@ bool PluginPackage::load() NP_InitializeFuncPtr NP_Initialize; NPError npErr; + gtkInitFunc* gtkInit; NP_Initialize = (NP_InitializeFuncPtr)m_module->resolve("NP_Initialize"); m_NPP_Shutdown = (NPP_ShutdownProcPtr)m_module->resolve("NP_Shutdown"); @@ -127,6 +130,26 @@ bool PluginPackage::load() m_browserFuncs.getvalue = staticPluginQuirkRequiresGtkToolKit_NPN_GetValue; } + // WORKAROUND: Prevent gtk based plugin crashes such as BR# 40567 by + // explicitly forcing the initializing of Gtk, i.e. calling gtk_init, + // whenver the symbol is present in the plugin library loaded above. + // Note that this workaround is based on code from the NSPluginClass ctor + // in KDE's kdebase/apps/nsplugins/viewer/nsplugin.cpp file. + gtkInit = (gtkInitFunc*)m_module->resolve("gtk_init"); + if (gtkInit) { + // Prevent gtk_init() from replacing the X error handlers, since the Gtk + // handlers abort when they receive an X error, thus killing the viewer. +#ifdef Q_WS_X11 + int (*old_error_handler)(Display*, XErrorEvent*) = XSetErrorHandler(0); + int (*old_io_error_handler)(Display*) = XSetIOErrorHandler(0); +#endif + gtkInit(0, 0); +#ifdef Q_WS_X11 + XSetErrorHandler(old_error_handler); + XSetIOErrorHandler(old_io_error_handler); +#endif + } + #if defined(XP_UNIX) npErr = NP_Initialize(&m_browserFuncs, &m_pluginFuncs); #else -- cgit v0.12 From 5c0462be41c7bad7a3e3ef08105fc1ca60d82e44 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Sun, 20 Jun 2010 22:12:43 +0200 Subject: Updated Harfbuzz from git+ssh://git.freedesktop.org/git/harfbuzz to ab9a897b688e991a8405cf938dea9d6a2f1ac072 From Andreas Kling : * Unbreak _HB_OPEN_Get_Device() and Get_ValueRecord() --- src/3rdparty/harfbuzz/src/harfbuzz-gpos.c | 25 ++++++----------------- src/3rdparty/harfbuzz/src/harfbuzz-open-private.h | 2 +- src/3rdparty/harfbuzz/src/harfbuzz-open.c | 14 +------------ 3 files changed, 8 insertions(+), 33 deletions(-) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c b/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c index d71a85e..31b9ae1 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c @@ -500,34 +500,24 @@ static HB_Error Get_ValueRecord( GPOS_Instance* gpi, { /* pixel -> fractional pixel */ - if ( format & HB_GPOS_FORMAT_HAVE_DEVICE_TABLES ) - { - if ( ALLOC_ARRAY( vr->DeviceTables, 4, HB_Device ) ) - return error; - vr->DeviceTables[VR_X_ADVANCE_DEVICE] = 0; - vr->DeviceTables[VR_Y_ADVANCE_DEVICE] = 0; - vr->DeviceTables[VR_X_PLACEMENT_DEVICE] = 0; - vr->DeviceTables[VR_Y_PLACEMENT_DEVICE] = 0; - } - if ( format & HB_GPOS_FORMAT_HAVE_X_PLACEMENT_DEVICE ) { - _HB_OPEN_Get_Device( &vr->DeviceTables[VR_X_PLACEMENT_DEVICE], x_ppem, &pixel_value ); + _HB_OPEN_Get_Device( vr->DeviceTables[VR_X_PLACEMENT_DEVICE], x_ppem, &pixel_value ); gd->x_pos += pixel_value << 6; } if ( format & HB_GPOS_FORMAT_HAVE_Y_PLACEMENT_DEVICE ) { - _HB_OPEN_Get_Device( &vr->DeviceTables[VR_Y_PLACEMENT_DEVICE], y_ppem, &pixel_value ); + _HB_OPEN_Get_Device( vr->DeviceTables[VR_Y_PLACEMENT_DEVICE], y_ppem, &pixel_value ); gd->y_pos += pixel_value << 6; } if ( format & HB_GPOS_FORMAT_HAVE_X_ADVANCE_DEVICE ) { - _HB_OPEN_Get_Device( &vr->DeviceTables[VR_X_ADVANCE_DEVICE], x_ppem, &pixel_value ); + _HB_OPEN_Get_Device( vr->DeviceTables[VR_X_ADVANCE_DEVICE], x_ppem, &pixel_value ); gd->x_advance += pixel_value << 6; } if ( format & HB_GPOS_FORMAT_HAVE_Y_ADVANCE_DEVICE ) { - _HB_OPEN_Get_Device( &vr->DeviceTables[VR_Y_ADVANCE_DEVICE], y_ppem, &pixel_value ); + _HB_OPEN_Get_Device( vr->DeviceTables[VR_Y_ADVANCE_DEVICE], y_ppem, &pixel_value ); gd->y_advance += pixel_value << 6; } } @@ -779,12 +769,9 @@ static HB_Error Get_Anchor( GPOS_Instance* gpi, case 3: if ( !gpi->dvi ) { - if ( ALLOC_ARRAY( an->af.af3.DeviceTables, 2, HB_Device ) ) - return error; - - _HB_OPEN_Get_Device( &an->af.af3.DeviceTables[AF3_X_DEVICE_TABLE], x_ppem, &pixel_value ); + _HB_OPEN_Get_Device( an->af.af3.DeviceTables[AF3_X_DEVICE_TABLE], x_ppem, &pixel_value ); *x_value = pixel_value << 6; - _HB_OPEN_Get_Device( &an->af.af3.DeviceTables[AF3_Y_DEVICE_TABLE], y_ppem, &pixel_value ); + _HB_OPEN_Get_Device( an->af.af3.DeviceTables[AF3_Y_DEVICE_TABLE], y_ppem, &pixel_value ); *y_value = pixel_value << 6; } else diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-open-private.h b/src/3rdparty/harfbuzz/src/harfbuzz-open-private.h index 1f7b353..65ca453 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-open-private.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-open-private.h @@ -93,7 +93,7 @@ _HB_OPEN_Get_Class( HB_ClassDefinition* cd, HB_UShort* klass, HB_UShort* index ); HB_INTERNAL HB_Error -_HB_OPEN_Get_Device( HB_Device** d, +_HB_OPEN_Get_Device( HB_Device* d, HB_UShort size, HB_Short* value ); diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-open.c b/src/3rdparty/harfbuzz/src/harfbuzz-open.c index 255b7e6..adc6cec 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-open.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-open.c @@ -1399,21 +1399,11 @@ _HB_OPEN_Free_Device( HB_Device** d ) mask = 0x00FF */ HB_INTERNAL HB_Error -_HB_OPEN_Get_Device( HB_Device** device, +_HB_OPEN_Get_Device( HB_Device* d, HB_UShort size, HB_Short* value ) { - HB_Device* d; HB_UShort byte, bits, mask, f, s; - HB_Error error; - - if ( ALLOC( *device, sizeof(HB_Device)) ) - { - *device = 0; - return error; - } - - d = *device; f = d->DeltaFormat; @@ -1436,8 +1426,6 @@ _HB_OPEN_Get_Device( HB_Device** device, else { *value = 0; - FREE( *device ); - *device = 0; return HB_Err_Not_Covered; } } -- cgit v0.12 From 3a9ca8ba50a63e564c15023f65cbac36d365d309 Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Mon, 21 Jun 2010 10:41:26 +0200 Subject: Fixing race condition in qeventdispatcher_symbian.cpp code path Fixing QT-3496. There was race condition for m_AOStatuses between external and QSelectThread. Task-number: QT-3496 Reviewed-by: TrustMe --- src/corelib/kernel/qeventdispatcher_symbian.cpp | 101 ++++++++++++++---------- src/corelib/kernel/qeventdispatcher_symbian_p.h | 5 ++ 2 files changed, 66 insertions(+), 40 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index d00a623..75b7619 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -114,9 +114,13 @@ public: // is in select call if (m_selectCallMutex->tryLock()) { m_selectCallMutex->unlock(); + + //m_threadMutex->lock(); + //bHasThreadLock = true; return; } + char dummy = 0; qt_pipe_write(fd, &dummy, 1); @@ -405,11 +409,14 @@ void QSelectThread::run() FD_ZERO(&exceptionfds); int maxfd = 0; - maxfd = qMax(maxfd, updateSocketSet(QSocketNotifier::Read, &readfds)); - maxfd = qMax(maxfd, updateSocketSet(QSocketNotifier::Write, &writefds)); - maxfd = qMax(maxfd, updateSocketSet(QSocketNotifier::Exception, &exceptionfds)); - maxfd = qMax(maxfd, m_pipeEnds[0]); - maxfd++; + { + QMutexLocker asoLocker(&m_AOStatusesMutex); + maxfd = qMax(maxfd, updateSocketSet(QSocketNotifier::Read, &readfds)); + maxfd = qMax(maxfd, updateSocketSet(QSocketNotifier::Write, &writefds)); + maxfd = qMax(maxfd, updateSocketSet(QSocketNotifier::Exception, &exceptionfds)); + maxfd = qMax(maxfd, m_pipeEnds[0]); + maxfd++; + } FD_SET(m_pipeEnds[0], &readfds); @@ -454,40 +461,42 @@ void QSelectThread::run() FD_ZERO(&readfds); FD_ZERO(&writefds); FD_ZERO(&exceptionfds); - for (QHash::const_iterator i = m_AOStatuses.begin(); - i != m_AOStatuses.end(); ++i) { + { + QMutexLocker asoLocker(&m_AOStatusesMutex); + for (QHash::const_iterator i = m_AOStatuses.begin(); + i != m_AOStatuses.end(); ++i) { - fd_set onefds; - FD_ZERO(&onefds); - FD_SET(i.key()->socket(), &onefds); + fd_set onefds; + FD_ZERO(&onefds); + FD_SET(i.key()->socket(), &onefds); - fd_set excfds; - FD_ZERO(&excfds); - FD_SET(i.key()->socket(), &excfds); + fd_set excfds; + FD_ZERO(&excfds); + FD_SET(i.key()->socket(), &excfds); - maxfd = i.key()->socket() + 1; + maxfd = i.key()->socket() + 1; - struct timeval timeout; - timeout.tv_sec = 0; - timeout.tv_usec = 0; + struct timeval timeout; + timeout.tv_sec = 0; + timeout.tv_usec = 0; - ret = 0; + ret = 0; - if(i.key()->type() == QSocketNotifier::Read) { - ret = ::select(maxfd, &onefds, 0, &excfds, &timeout); - if(ret != 0) FD_SET(i.key()->socket(), &readfds); - } else if(i.key()->type() == QSocketNotifier::Write) { - ret = ::select(maxfd, 0, &onefds, &excfds, &timeout); - if(ret != 0) FD_SET(i.key()->socket(), &writefds); - } + if(i.key()->type() == QSocketNotifier::Read) { + ret = ::select(maxfd, &onefds, 0, &excfds, &timeout); + if(ret != 0) FD_SET(i.key()->socket(), &readfds); + } else if(i.key()->type() == QSocketNotifier::Write) { + ret = ::select(maxfd, 0, &onefds, &excfds, &timeout); + if(ret != 0) FD_SET(i.key()->socket(), &writefds); + } - } // end for - - // traversed all, so update - updateActivatedNotifiers(QSocketNotifier::Exception, &exceptionfds); - updateActivatedNotifiers(QSocketNotifier::Read, &readfds); - updateActivatedNotifiers(QSocketNotifier::Write, &writefds); + } // end for + // traversed all, so update + updateActivatedNotifiers(QSocketNotifier::Exception, &exceptionfds); + updateActivatedNotifiers(QSocketNotifier::Read, &readfds); + updateActivatedNotifiers(QSocketNotifier::Write, &writefds); + } break; case EINTR: // Should never occur on Symbian, but this is future proof! default: @@ -496,9 +505,12 @@ void QSelectThread::run() break; } } else { - updateActivatedNotifiers(QSocketNotifier::Exception, &exceptionfds); - updateActivatedNotifiers(QSocketNotifier::Read, &readfds); - updateActivatedNotifiers(QSocketNotifier::Write, &writefds); + { + QMutexLocker asoLocker(&m_AOStatusesMutex); + updateActivatedNotifiers(QSocketNotifier::Exception, &exceptionfds); + updateActivatedNotifiers(QSocketNotifier::Read, &readfds); + updateActivatedNotifiers(QSocketNotifier::Write, &writefds); + } } m_waitCond.wait(&m_mutex); @@ -517,11 +529,15 @@ void QSelectThread::requestSocketEvents ( QSocketNotifier *notifier, TRequestSta QMutexLocker locker(&m_grabberMutex); - QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex, &m_selectCallMutex); - - Q_ASSERT(!m_AOStatuses.contains(notifier)); + { + // first do the thing + QMutexLocker aosLocker(&m_AOStatusesMutex); + Q_ASSERT(!m_AOStatuses.contains(notifier)); + m_AOStatuses.insert(notifier, status); + } - m_AOStatuses.insert(notifier, status); + // and now tell it to the others + QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex, &m_selectCallMutex); m_waitCond.wakeAll(); } @@ -530,9 +546,14 @@ void QSelectThread::cancelSocketEvents ( QSocketNotifier *notifier ) { QMutexLocker locker(&m_grabberMutex); - QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex, &m_selectCallMutex); + { + // first do the thing + QMutexLocker aosLocker(&m_AOStatusesMutex); + m_AOStatuses.remove(notifier); + } - m_AOStatuses.remove(notifier); + // and now tell it to the others + QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex, &m_selectCallMutex); m_waitCond.wakeAll(); } diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h index 7021314..68d5833 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian_p.h +++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h @@ -231,6 +231,11 @@ private: // causes later in locking // of the thread in waitcond QMutex m_selectCallMutex; + + // Argh ... not again + // one more unprotected + // resource is m_AOStatuses + QMutex m_AOStatusesMutex; }; class Q_CORE_EXPORT CQtActiveScheduler : public CActiveScheduler -- cgit v0.12 From 41e284f14ff0c8f9a0e0ca55c4b547dec0d9c09a Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 21 Jun 2010 14:18:00 +0200 Subject: Prevent warnings about EPOCROOT coming out when not on symbian When the pro file is processed with qmake and it EPOCROOT is not set then it will give out warnings. This is really only an issue when configure on X11 is ran because this runs qmake on all pro files anyway. So rather than confusing users about what this warning message means on a non Symbian platform, we just ensure that the pro file specifically only does anything useful on Symbian platforms. Reviewed-by: Gareth Stockwell --- src/plugins/phonon/mmf/mmf.pro | 250 ++++++++++++++++++++--------------------- 1 file changed, 125 insertions(+), 125 deletions(-) diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro index da41f18..7a6fdf8 100644 --- a/src/plugins/phonon/mmf/mmf.pro +++ b/src/plugins/phonon/mmf/mmf.pro @@ -1,127 +1,127 @@ # MMF Phonon backend - -QT += phonon -TARGET = phonon_mmf -PHONON_MMF_DIR = $$QT_SOURCE_TREE/src/3rdparty/phonon/mmf - -# Uncomment the following line in order to use the CDrmPlayerUtility client -# API for audio playback, rather than CMdaAudioPlayerUtility. -#CONFIG += phonon_mmf_audio_drm - -phonon_mmf_audio_drm { - LIBS += -lDrmAudioPlayUtility - DEFINES += QT_PHONON_MMF_AUDIO_DRM -} else { - LIBS += -lmediaclientaudio -} - -# This is necessary because both epoc32/include and Phonon contain videoplayer.h. -# By making /epoc32/include the first SYSTEMINCLUDE, we ensure that -# '#include ' picks up the Symbian header, as intended. -PREPEND_INCLUDEPATH = /epoc32/include - -PREPEND_INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty - -INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE - -HEADERS += \ - $$PHONON_MMF_DIR/abstractaudioeffect.h \ - $$PHONON_MMF_DIR/abstractmediaplayer.h \ - $$PHONON_MMF_DIR/abstractplayer.h \ - $$PHONON_MMF_DIR/abstractvideooutput.h \ - $$PHONON_MMF_DIR/abstractvideoplayer.h \ - $$PHONON_MMF_DIR/audioequalizer.h \ - $$PHONON_MMF_DIR/audiooutput.h \ - $$PHONON_MMF_DIR/audioplayer.h \ - $$PHONON_MMF_DIR/backend.h \ - $$PHONON_MMF_DIR/bassboost.h \ - $$PHONON_MMF_DIR/defs.h \ - $$PHONON_MMF_DIR/dummyplayer.h \ - $$PHONON_MMF_DIR/effectfactory.h \ - $$PHONON_MMF_DIR/effectparameter.h \ - $$PHONON_MMF_DIR/environmentalreverb.h \ - $$PHONON_MMF_DIR/loudness.h \ - $$PHONON_MMF_DIR/mediaobject.h \ - $$PHONON_MMF_DIR/mmf_medianode.h \ - $$PHONON_MMF_DIR/stereowidening.h \ - $$PHONON_MMF_DIR/objectdump.h \ - $$PHONON_MMF_DIR/objectdump_symbian.h \ - $$PHONON_MMF_DIR/objecttree.h \ - $$PHONON_MMF_DIR/utils.h \ - $$PHONON_MMF_DIR/videowidget.h - -SOURCES += \ - $$PHONON_MMF_DIR/abstractaudioeffect.cpp \ - $$PHONON_MMF_DIR/abstractmediaplayer.cpp \ - $$PHONON_MMF_DIR/abstractplayer.cpp \ - $$PHONON_MMF_DIR/audioequalizer.cpp \ - $$PHONON_MMF_DIR/audiooutput.cpp \ - $$PHONON_MMF_DIR/audioplayer.cpp \ - $$PHONON_MMF_DIR/abstractvideooutput.cpp \ - $$PHONON_MMF_DIR/abstractvideoplayer.cpp \ - $$PHONON_MMF_DIR/backend.cpp \ - $$PHONON_MMF_DIR/bassboost.cpp \ - $$PHONON_MMF_DIR/dummyplayer.cpp \ - $$PHONON_MMF_DIR/effectfactory.cpp \ - $$PHONON_MMF_DIR/effectparameter.cpp \ - $$PHONON_MMF_DIR/environmentalreverb.cpp \ - $$PHONON_MMF_DIR/loudness.cpp \ - $$PHONON_MMF_DIR/mediaobject.cpp \ - $$PHONON_MMF_DIR/mmf_medianode.cpp \ - $$PHONON_MMF_DIR/stereowidening.cpp \ - $$PHONON_MMF_DIR/objectdump.cpp \ - $$PHONON_MMF_DIR/objectdump_symbian.cpp \ - $$PHONON_MMF_DIR/objecttree.cpp \ - $$PHONON_MMF_DIR/utils.cpp \ - $$PHONON_MMF_DIR/videowidget.cpp - -# Test for whether the build environment supports video rendering to graphics -# surfaces. -exists($${EPOCROOT}epoc32/include/platform/videoplayer2.h) { - HEADERS += \ - $$PHONON_MMF_DIR/videooutput_surface.h \ - $$PHONON_MMF_DIR/videoplayer_surface.h - SOURCES += \ - $$PHONON_MMF_DIR/videooutput_surface.cpp \ - $$PHONON_MMF_DIR/videoplayer_surface.cpp - DEFINES += PHONON_MMF_VIDEO_SURFACES -} else { - HEADERS += \ - $$PHONON_MMF_DIR/ancestormovemonitor.h \ - $$PHONON_MMF_DIR/videooutput_dsa.h \ - $$PHONON_MMF_DIR/videoplayer_dsa.h - SOURCES += \ - $$PHONON_MMF_DIR/ancestormovemonitor.cpp \ - $$PHONON_MMF_DIR/videooutput_dsa.cpp \ - $$PHONON_MMF_DIR/videoplayer_dsa.cpp \ +symbian { + QT += phonon + TARGET = phonon_mmf + PHONON_MMF_DIR = $$QT_SOURCE_TREE/src/3rdparty/phonon/mmf + + # Uncomment the following line in order to use the CDrmPlayerUtility client + # API for audio playback, rather than CMdaAudioPlayerUtility. + #CONFIG += phonon_mmf_audio_drm + + phonon_mmf_audio_drm { + LIBS += -lDrmAudioPlayUtility + DEFINES += QT_PHONON_MMF_AUDIO_DRM + } else { + LIBS += -lmediaclientaudio + } + + # This is necessary because both epoc32/include and Phonon contain videoplayer.h. + # By making /epoc32/include the first SYSTEMINCLUDE, we ensure that + # '#include ' picks up the Symbian header, as intended. + PREPEND_INCLUDEPATH = /epoc32/include + + PREPEND_INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty + + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + + HEADERS += \ + $$PHONON_MMF_DIR/abstractaudioeffect.h \ + $$PHONON_MMF_DIR/abstractmediaplayer.h \ + $$PHONON_MMF_DIR/abstractplayer.h \ + $$PHONON_MMF_DIR/abstractvideooutput.h \ + $$PHONON_MMF_DIR/abstractvideoplayer.h \ + $$PHONON_MMF_DIR/audioequalizer.h \ + $$PHONON_MMF_DIR/audiooutput.h \ + $$PHONON_MMF_DIR/audioplayer.h \ + $$PHONON_MMF_DIR/backend.h \ + $$PHONON_MMF_DIR/bassboost.h \ + $$PHONON_MMF_DIR/defs.h \ + $$PHONON_MMF_DIR/dummyplayer.h \ + $$PHONON_MMF_DIR/effectfactory.h \ + $$PHONON_MMF_DIR/effectparameter.h \ + $$PHONON_MMF_DIR/environmentalreverb.h \ + $$PHONON_MMF_DIR/loudness.h \ + $$PHONON_MMF_DIR/mediaobject.h \ + $$PHONON_MMF_DIR/mmf_medianode.h \ + $$PHONON_MMF_DIR/stereowidening.h \ + $$PHONON_MMF_DIR/objectdump.h \ + $$PHONON_MMF_DIR/objectdump_symbian.h \ + $$PHONON_MMF_DIR/objecttree.h \ + $$PHONON_MMF_DIR/utils.h \ + $$PHONON_MMF_DIR/videowidget.h + + SOURCES += \ + $$PHONON_MMF_DIR/abstractaudioeffect.cpp \ + $$PHONON_MMF_DIR/abstractmediaplayer.cpp \ + $$PHONON_MMF_DIR/abstractplayer.cpp \ + $$PHONON_MMF_DIR/audioequalizer.cpp \ + $$PHONON_MMF_DIR/audiooutput.cpp \ + $$PHONON_MMF_DIR/audioplayer.cpp \ + $$PHONON_MMF_DIR/abstractvideooutput.cpp \ + $$PHONON_MMF_DIR/abstractvideoplayer.cpp \ + $$PHONON_MMF_DIR/backend.cpp \ + $$PHONON_MMF_DIR/bassboost.cpp \ + $$PHONON_MMF_DIR/dummyplayer.cpp \ + $$PHONON_MMF_DIR/effectfactory.cpp \ + $$PHONON_MMF_DIR/effectparameter.cpp \ + $$PHONON_MMF_DIR/environmentalreverb.cpp \ + $$PHONON_MMF_DIR/loudness.cpp \ + $$PHONON_MMF_DIR/mediaobject.cpp \ + $$PHONON_MMF_DIR/mmf_medianode.cpp \ + $$PHONON_MMF_DIR/stereowidening.cpp \ + $$PHONON_MMF_DIR/objectdump.cpp \ + $$PHONON_MMF_DIR/objectdump_symbian.cpp \ + $$PHONON_MMF_DIR/objecttree.cpp \ + $$PHONON_MMF_DIR/utils.cpp \ + $$PHONON_MMF_DIR/videowidget.cpp + + # Test for whether the build environment supports video rendering to graphics + # surfaces. + symbian:exists($${EPOCROOT}epoc32/include/platform/videoplayer2.h) { + HEADERS += \ + $$PHONON_MMF_DIR/videooutput_surface.h \ + $$PHONON_MMF_DIR/videoplayer_surface.h + SOURCES += \ + $$PHONON_MMF_DIR/videooutput_surface.cpp \ + $$PHONON_MMF_DIR/videoplayer_surface.cpp + DEFINES += PHONON_MMF_VIDEO_SURFACES + } else { + HEADERS += \ + $$PHONON_MMF_DIR/ancestormovemonitor.h \ + $$PHONON_MMF_DIR/videooutput_dsa.h \ + $$PHONON_MMF_DIR/videoplayer_dsa.h + SOURCES += \ + $$PHONON_MMF_DIR/ancestormovemonitor.cpp \ + $$PHONON_MMF_DIR/videooutput_dsa.cpp \ + $$PHONON_MMF_DIR/videoplayer_dsa.cpp \ + } + + LIBS += -lcone + LIBS += -lws32 + + # This is only needed for debug builds, but is always linked against. + LIBS += -lhal + + TARGET.CAPABILITY = all -tcb + + LIBS += -lmediaclientvideo # For CVideoPlayerUtility + LIBS += -lcone # For CCoeEnv + LIBS += -lws32 # For RWindow + LIBS += -lefsrv # For file server + LIBS += -lapgrfx -lapmime # For recognizer + LIBS += -lmmfcontrollerframework # For CMMFMetaDataEntry + LIBS += -lmediaclientaudiostream # For CMdaAudioOutputStream + + # These are for effects. + LIBS += -lAudioEqualizerEffect -lBassBoostEffect -lDistanceAttenuationEffect -lDopplerBase -lEffectBase -lEnvironmentalReverbEffect -lListenerDopplerEffect -lListenerLocationEffect -lListenerOrientationEffect -lLocationBase -lLoudnessEffect -lOrientationBase -lSourceDopplerEffect -lSourceLocationEffect -lSourceOrientationEffect -lStereoWideningEffect + + # This is needed for having the .qtplugin file properly created on Symbian. + QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/phonon_backend + + target.path = $$[QT_INSTALL_PLUGINS]/phonon_backend + INSTALLS += target + + include(../../qpluginbase.pri) + + TARGET.UID3=0x2001E629 } - -LIBS += -lcone -LIBS += -lws32 - -# This is only needed for debug builds, but is always linked against. -LIBS += -lhal - -TARGET.CAPABILITY = all -tcb - -LIBS += -lmediaclientvideo # For CVideoPlayerUtility -LIBS += -lcone # For CCoeEnv -LIBS += -lws32 # For RWindow -LIBS += -lefsrv # For file server -LIBS += -lapgrfx -lapmime # For recognizer -LIBS += -lmmfcontrollerframework # For CMMFMetaDataEntry -LIBS += -lmediaclientaudiostream # For CMdaAudioOutputStream - -# These are for effects. -LIBS += -lAudioEqualizerEffect -lBassBoostEffect -lDistanceAttenuationEffect -lDopplerBase -lEffectBase -lEnvironmentalReverbEffect -lListenerDopplerEffect -lListenerLocationEffect -lListenerOrientationEffect -lLocationBase -lLoudnessEffect -lOrientationBase -lSourceDopplerEffect -lSourceLocationEffect -lSourceOrientationEffect -lStereoWideningEffect - -# This is needed for having the .qtplugin file properly created on Symbian. -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/phonon_backend - -target.path = $$[QT_INSTALL_PLUGINS]/phonon_backend -INSTALLS += target - -include(../../qpluginbase.pri) - -TARGET.UID3=0x2001E629 - -- cgit v0.12 From 569860f721a30d5caad8ea1b55a3220f7e7f3d56 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 21 Jun 2010 18:52:45 +0200 Subject: Fix null HB_Device** dereference on exit in Harfbuzz GPOS code Fix incorrect usage of _HB_OPEN_Free_Device() in CaretValue cleanup --- src/3rdparty/harfbuzz/src/harfbuzz-gdef.c | 2 +- src/3rdparty/harfbuzz/src/harfbuzz-gpos.c | 26 +++++++++++++---------- src/3rdparty/harfbuzz/src/harfbuzz-open-private.h | 2 +- src/3rdparty/harfbuzz/src/harfbuzz-open.c | 8 +++---- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gdef.c b/src/3rdparty/harfbuzz/src/harfbuzz-gdef.c index c0c6f2c..966b167 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-gdef.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-gdef.c @@ -462,7 +462,7 @@ static HB_Error Load_CaretValue( HB_CaretValue* cv, static void Free_CaretValue( HB_CaretValue* cv) { if ( cv->CaretValueFormat == 3 ) - _HB_OPEN_Free_Device( &cv->cvf.cvf3.Device ); + _HB_OPEN_Free_Device( cv->cvf.cvf3.Device ); } diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c b/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c index 31b9ae1..0236271 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c @@ -433,13 +433,16 @@ static HB_Error Load_ValueRecord( HB_ValueRecord* vr, return HB_Err_Ok; Fail1: - _HB_OPEN_Free_Device( &vr->DeviceTables[VR_Y_ADVANCE_DEVICE] ); + if ( vr->DeviceTables ) + _HB_OPEN_Free_Device( vr->DeviceTables[VR_Y_ADVANCE_DEVICE] ); Fail2: - _HB_OPEN_Free_Device( &vr->DeviceTables[VR_X_ADVANCE_DEVICE] ); + if ( vr->DeviceTables ) + _HB_OPEN_Free_Device( vr->DeviceTables[VR_X_ADVANCE_DEVICE] ); Fail3: - _HB_OPEN_Free_Device( &vr->DeviceTables[VR_Y_PLACEMENT_DEVICE] ); + if ( vr->DeviceTables ) + _HB_OPEN_Free_Device( vr->DeviceTables[VR_Y_PLACEMENT_DEVICE] ); FREE( vr->DeviceTables ); return error; @@ -450,13 +453,13 @@ static void Free_ValueRecord( HB_ValueRecord* vr, HB_UShort format ) { if ( format & HB_GPOS_FORMAT_HAVE_Y_ADVANCE_DEVICE ) - _HB_OPEN_Free_Device( &vr->DeviceTables[VR_Y_ADVANCE_DEVICE] ); + _HB_OPEN_Free_Device( vr->DeviceTables[VR_Y_ADVANCE_DEVICE] ); if ( format & HB_GPOS_FORMAT_HAVE_X_ADVANCE_DEVICE ) - _HB_OPEN_Free_Device( &vr->DeviceTables[VR_X_ADVANCE_DEVICE] ); + _HB_OPEN_Free_Device( vr->DeviceTables[VR_X_ADVANCE_DEVICE] ); if ( format & HB_GPOS_FORMAT_HAVE_Y_PLACEMENT_DEVICE ) - _HB_OPEN_Free_Device( &vr->DeviceTables[VR_Y_PLACEMENT_DEVICE] ); + _HB_OPEN_Free_Device( vr->DeviceTables[VR_Y_PLACEMENT_DEVICE] ); if ( format & HB_GPOS_FORMAT_HAVE_X_PLACEMENT_DEVICE ) - _HB_OPEN_Free_Device( &vr->DeviceTables[VR_X_PLACEMENT_DEVICE] ); + _HB_OPEN_Free_Device( vr->DeviceTables[VR_X_PLACEMENT_DEVICE] ); FREE( vr->DeviceTables ); } @@ -688,7 +691,8 @@ static HB_Error Load_Anchor( HB_Anchor* an, return HB_Err_Ok; Fail: - _HB_OPEN_Free_Device( &an->af.af3.DeviceTables[AF3_X_DEVICE_TABLE] ); + if ( an->af.af3.DeviceTables ) + _HB_OPEN_Free_Device( an->af.af3.DeviceTables[AF3_X_DEVICE_TABLE] ); FREE( an->af.af3.DeviceTables ); return error; @@ -697,10 +701,10 @@ Fail: static void Free_Anchor( HB_Anchor* an) { - if ( an->PosFormat == 3 ) + if ( an->PosFormat == 3 && an->af.af3.DeviceTables ) { - _HB_OPEN_Free_Device( &an->af.af3.DeviceTables[AF3_X_DEVICE_TABLE] ); - _HB_OPEN_Free_Device( &an->af.af3.DeviceTables[AF3_Y_DEVICE_TABLE] ); + _HB_OPEN_Free_Device( an->af.af3.DeviceTables[AF3_X_DEVICE_TABLE] ); + _HB_OPEN_Free_Device( an->af.af3.DeviceTables[AF3_Y_DEVICE_TABLE] ); FREE( an->af.af3.DeviceTables ); } } diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-open-private.h b/src/3rdparty/harfbuzz/src/harfbuzz-open-private.h index 65ca453..f1ca278 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-open-private.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-open-private.h @@ -79,7 +79,7 @@ HB_INTERNAL void _HB_OPEN_Free_LookupList( HB_LookupList* ll, HB_INTERNAL void _HB_OPEN_Free_Coverage( HB_Coverage* c ); HB_INTERNAL void _HB_OPEN_Free_ClassDefinition( HB_ClassDefinition* cd ); -HB_INTERNAL void _HB_OPEN_Free_Device( HB_Device** d ); +HB_INTERNAL void _HB_OPEN_Free_Device( HB_Device* d ); diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-open.c b/src/3rdparty/harfbuzz/src/harfbuzz-open.c index adc6cec..15cd2c1 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-open.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-open.c @@ -1353,12 +1353,12 @@ _HB_OPEN_Load_Device( HB_Device** device, HB_INTERNAL void -_HB_OPEN_Free_Device( HB_Device** d ) +_HB_OPEN_Free_Device( HB_Device* d ) { - if ( *d ) + if ( d ) { - FREE( (*d)->DeltaValue ); - FREE( *d ); + FREE( d->DeltaValue ); + FREE( d ); } } -- cgit v0.12 From b82ed43086aebb4698a8a52965eeb17349ef1d04 Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Mon, 21 Jun 2010 15:11:59 +1000 Subject: Audio(osx); Fix audio format converters. Reviewed-by:Dmytro Poplavskiy --- src/multimedia/audio/qaudio_mac.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/multimedia/audio/qaudio_mac.cpp b/src/multimedia/audio/qaudio_mac.cpp index 14fee8b..4e17b52 100644 --- a/src/multimedia/audio/qaudio_mac.cpp +++ b/src/multimedia/audio/qaudio_mac.cpp @@ -68,11 +68,11 @@ QAudioFormat toQAudioFormat(AudioStreamBasicDescription const& sf) audioFormat.setChannels(sf.mChannelsPerFrame); audioFormat.setSampleSize(sf.mBitsPerChannel); audioFormat.setCodec(QString::fromLatin1("audio/pcm")); - audioFormat.setByteOrder(sf.mFormatFlags & kLinearPCMFormatFlagIsBigEndian != 0 ? QAudioFormat::BigEndian : QAudioFormat::LittleEndian); + audioFormat.setByteOrder((sf.mFormatFlags & kAudioFormatFlagIsBigEndian) != 0 ? QAudioFormat::BigEndian : QAudioFormat::LittleEndian); QAudioFormat::SampleType type = QAudioFormat::UnSignedInt; - if ((sf.mFormatFlags & kLinearPCMFormatFlagIsSignedInteger) != 0) + if ((sf.mFormatFlags & kAudioFormatFlagIsSignedInteger) != 0) type = QAudioFormat::SignedInt; - else if ((sf.mFormatFlags & kLinearPCMFormatFlagIsFloat) != 0) + else if ((sf.mFormatFlags & kAudioFormatFlagIsFloat) != 0) type = QAudioFormat::Float; audioFormat.setSampleType(type); @@ -99,6 +99,9 @@ AudioStreamBasicDescription toAudioStreamBasicDescription(QAudioFormat const& au case QAudioFormat::Unknown: default: break; } + if (audioFormat.byteOrder() == QAudioFormat::BigEndian) + sf.mFormatFlags |= kAudioFormatFlagIsBigEndian; + return sf; } -- cgit v0.12 From 66d02e4bde0a628978436217032abe555ed77fad Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Mon, 21 Jun 2010 15:18:32 +1000 Subject: Audio(osx); refactor input period conversion Reviewed-by:Dmytro Poplavskiy --- src/multimedia/audio/qaudioinput_mac_p.cpp | 49 +++++++++++++++--------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/src/multimedia/audio/qaudioinput_mac_p.cpp b/src/multimedia/audio/qaudioinput_mac_p.cpp index b99fe11..5897e75 100644 --- a/src/multimedia/audio/qaudioinput_mac_p.cpp +++ b/src/multimedia/audio/qaudioinput_mac_p.cpp @@ -210,6 +210,11 @@ public: return true; } + bool empty() const + { + return position == totalPackets; + } + private: UInt32 totalPackets; UInt32 position; @@ -275,36 +280,32 @@ public: if (m_audioConverter != 0) { QAudioPacketFeeder feeder(m_inputBufferList); - bool wecan = true; int copied = 0; - const int available = m_buffer->free(); - while (err == noErr && wecan) { + while (err == noErr && !feeder.empty()) { QAudioRingBuffer::Region region = m_buffer->acquireWriteRegion(available); - if (region.second > 0) { - AudioBufferList output; - output.mNumberBuffers = 1; - output.mBuffers[0].mNumberChannels = 1; - output.mBuffers[0].mDataByteSize = region.second; - output.mBuffers[0].mData = region.first; - - UInt32 packetSize = region.second / m_outputFormat.mBytesPerPacket; - err = AudioConverterFillComplexBuffer(m_audioConverter, - converterCallback, - &feeder, - &packetSize, - &output, - 0); - - region.second = output.mBuffers[0].mDataByteSize; - copied += region.second; + if (region.second == 0) + break; + + AudioBufferList output; + output.mNumberBuffers = 1; + output.mBuffers[0].mNumberChannels = 1; + output.mBuffers[0].mDataByteSize = region.second; + output.mBuffers[0].mData = region.first; + + UInt32 packetSize = region.second / m_outputFormat.mBytesPerPacket; + err = AudioConverterFillComplexBuffer(m_audioConverter, + converterCallback, + &feeder, + &packetSize, + &output, + 0); + region.second = output.mBuffers[0].mDataByteSize; + copied += region.second; - m_buffer->releaseWriteRegion(region); - } - else - wecan = false; + m_buffer->releaseWriteRegion(region); } framesRendered += copied / m_outputFormat.mBytesPerFrame; -- cgit v0.12 From 76c256bdabcc207a6ed70d5b5b62698495548a25 Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Tue, 22 Jun 2010 12:01:51 +1000 Subject: Audio(osx); Fix period size calculation. Task-number: QTBUG-8878 Reviewed-by:Dmytro Poplavskiy --- src/multimedia/audio/qaudiooutput_mac_p.cpp | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/multimedia/audio/qaudiooutput_mac_p.cpp b/src/multimedia/audio/qaudiooutput_mac_p.cpp index 9689101..cc52d90 100644 --- a/src/multimedia/audio/qaudiooutput_mac_p.cpp +++ b/src/multimedia/audio/qaudiooutput_mac_p.cpp @@ -358,17 +358,7 @@ bool QAudioOutputPrivate::open() // Set stream format streamFormat = toAudioStreamBasicDescription(audioFormat); - UInt32 size = sizeof(deviceFormat); - if (AudioUnitGetProperty(audioUnit, - kAudioUnitProperty_StreamFormat, - kAudioUnitScope_Input, - 0, - &deviceFormat, - &size) != noErr) { - qWarning() << "QAudioOutput: Unable to retrieve device format"; - return false; - } - + UInt32 size = sizeof(streamFormat); if (AudioUnitSetProperty(audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, @@ -392,8 +382,7 @@ bool QAudioOutputPrivate::open() return false; } - periodSizeBytes = (numberOfFrames * streamFormat.mSampleRate / deviceFormat.mSampleRate) * - streamFormat.mBytesPerFrame; + periodSizeBytes = numberOfFrames * streamFormat.mBytesPerFrame; if (internalBufferSize < periodSizeBytes * 2) internalBufferSize = periodSizeBytes * 2; else -- cgit v0.12 From f02bb3b14ab0257a11cb9cde692f87a046c0308b Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Tue, 22 Jun 2010 16:59:08 +1000 Subject: Phonon(qt7); Don't try and display video frames when audio only. Task-number: QTBUG-9068 --- src/3rdparty/phonon/qt7/mediaobject.mm | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/3rdparty/phonon/qt7/mediaobject.mm b/src/3rdparty/phonon/qt7/mediaobject.mm index 677640c..ca206bc 100644 --- a/src/3rdparty/phonon/qt7/mediaobject.mm +++ b/src/3rdparty/phonon/qt7/mediaobject.mm @@ -405,20 +405,22 @@ void MediaObject::restartAudioVideoTimers() if (m_audioTimer) killTimer(m_audioTimer); + if (hasVideo()) { #if QT_ALLOW_QUICKTIME // We prefer to use a display link as timer if available, since // it is more steady, and results in better and smoother frame drawing: - startDisplayLink(); - if (!m_displayLink){ + startDisplayLink(); + if (!m_displayLink){ + float fps = m_videoPlayer->staticFps(); + long videoUpdateFrequency = fps ? long(1000.0f / fps) : 0.001; + m_videoTimer = startTimer(videoUpdateFrequency); + } +#else float fps = m_videoPlayer->staticFps(); long videoUpdateFrequency = fps ? long(1000.0f / fps) : 0.001; m_videoTimer = startTimer(videoUpdateFrequency); - } -#else - float fps = m_videoPlayer->staticFps(); - long videoUpdateFrequency = fps ? long(1000.0f / fps) : 0.001; - m_videoTimer = startTimer(videoUpdateFrequency); #endif + } long audioUpdateFrequency = m_audioPlayer->regularTaskFrequency(); m_audioTimer = startTimer(audioUpdateFrequency); -- cgit v0.12 From da024f96bf0969cd0de85389e621a14c3381add8 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 22 Jun 2010 09:09:32 +0200 Subject: Make sure ValueRecord's DeviceTables are cleaned up on failure Cleanup was a missing for the case where loading an X placement device table failed. --- src/3rdparty/harfbuzz/src/harfbuzz-gpos.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c b/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c index 0236271..d6f9207 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c @@ -273,7 +273,7 @@ static HB_Error Load_ValueRecord( HB_ValueRecord* vr, if ( format & HB_GPOS_FORMAT_HAVE_X_PLACEMENT_DEVICE ) { if ( ACCESS_Frame( 2L ) ) - return error; + goto Fail4; new_offset = GET_UShort(); @@ -287,7 +287,7 @@ static HB_Error Load_ValueRecord( HB_ValueRecord* vr, if ( FILE_Seek( new_offset ) || ( error = _HB_OPEN_Load_Device( &vr->DeviceTables[VR_X_PLACEMENT_DEVICE], stream ) ) != HB_Err_Ok ) - return error; + goto Fail4; (void)FILE_Seek( cur_offset ); } } @@ -444,6 +444,7 @@ Fail3: if ( vr->DeviceTables ) _HB_OPEN_Free_Device( vr->DeviceTables[VR_Y_PLACEMENT_DEVICE] ); +Fail4: FREE( vr->DeviceTables ); return error; } -- cgit v0.12 From bae2219587a8c1a4c922d1cde51616e3ea1df370 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 22 Jun 2010 09:37:34 +0200 Subject: Clean up HB_Anchor's DeviceTables on failure when loading format 3 --- src/3rdparty/harfbuzz/src/harfbuzz-gpos.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c b/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c index d6f9207..a216005 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-gpos.c @@ -637,7 +637,7 @@ static HB_Error Load_Anchor( HB_Anchor* an, if ( FILE_Seek( new_offset ) || ( error = _HB_OPEN_Load_Device( &an->af.af3.DeviceTables[AF3_X_DEVICE_TABLE], stream ) ) != HB_Err_Ok ) - return error; + goto Fail2; (void)FILE_Seek( cur_offset ); } @@ -695,6 +695,7 @@ Fail: if ( an->af.af3.DeviceTables ) _HB_OPEN_Free_Device( an->af.af3.DeviceTables[AF3_X_DEVICE_TABLE] ); +Fail2: FREE( an->af.af3.DeviceTables ); return error; } -- cgit v0.12 From b4dd04f50b2e275ef9f8e643f33143d20a436203 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 22 Jun 2010 12:18:13 +0200 Subject: Updated Harfbuzz from git+ssh://git.freedesktop.org/git/harfbuzz to f0dcb906fe56b5dc06aa305b6cfc821d5dd25a28 * Import f0dcb906fe56b5dc06aa305b6cfc821d5dd25a28 which fixes a crash with certain fonts. --- src/3rdparty/harfbuzz/src/harfbuzz-open.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-open.c b/src/3rdparty/harfbuzz/src/harfbuzz-open.c index 15cd2c1..f12f5b7 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-open.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-open.c @@ -1403,12 +1403,11 @@ _HB_OPEN_Get_Device( HB_Device* d, HB_UShort size, HB_Short* value ) { - HB_UShort byte, bits, mask, f, s; + HB_UShort byte, bits, mask, s; - f = d->DeltaFormat; - - if ( d->DeltaValue && size >= d->StartSize && size <= d->EndSize ) + if ( d && d->DeltaValue && size >= d->StartSize && size <= d->EndSize ) { + HB_UShort f = d->DeltaFormat; s = size - d->StartSize; byte = d->DeltaValue[s >> ( 4 - f )]; bits = byte >> ( 16 - ( ( s % ( 1 << ( 4 - f ) ) + 1 ) << f ) ); -- cgit v0.12 From 1aee8f71da584525eea569690110ca2ed471c5ae Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 23 Jun 2010 07:44:10 +0200 Subject: Ensure that compiling with the no debug/warning output defines works The defines that can be used are QT_NO_DEBUG_OUTPUT and QT_NO_WARNING_OUTPUT in order to turn off qDebug and qWarning output. Reviewed-by: cduclos Reviewed-by: Markus Goetz --- src/gui/accessible/qaccessible_mac_cocoa.mm | 4 ++++ src/network/access/qftp.cpp | 2 +- src/opengl/qgl_p.h | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/accessible/qaccessible_mac_cocoa.mm b/src/gui/accessible/qaccessible_mac_cocoa.mm index 1688404..ada927e 100644 --- a/src/gui/accessible/qaccessible_mac_cocoa.mm +++ b/src/gui/accessible/qaccessible_mac_cocoa.mm @@ -58,11 +58,15 @@ QT_BEGIN_NAMESPACE //#define MAC_ACCESSIBILTY_DEVELOPER_MODE +#ifndef QT_NO_DEBUG_STREAM #ifdef MAC_ACCESSIBILTY_DEVELOPER_MODE #define MAC_ACCESSIBILTY_DEBUG QT_PREPEND_NAMESPACE(qDebug) #else #define MAC_ACCESSIBILTY_DEBUG if (0) QT_PREPEND_NAMESPACE(qDebug) #endif +#else +#define MAC_ACCESSIBILTY_DEBUG if (0) QT_PREPEND_NAMESPACE(QNoDebug) +#endif typedef QMap QMacAccessibiltyRoleMap; Q_GLOBAL_STATIC(QMacAccessibiltyRoleMap, qMacAccessibiltyRoleMap); diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp index 7f6df0a..97219f4 100644 --- a/src/network/access/qftp.cpp +++ b/src/network/access/qftp.cpp @@ -2311,7 +2311,7 @@ void QFtpPrivate::_q_piError(int errorCode, const QString &text) Q_Q(QFtp); if (pending.isEmpty()) { - qWarning() << "QFtpPrivate::_q_piError was called without pending command!"; + qWarning("QFtpPrivate::_q_piError was called without pending command!"); return; } diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 191131e..4facb65 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -114,7 +114,7 @@ QT_BEGIN_INCLUDE_NAMESPACE QT_END_INCLUDE_NAMESPACE # ifdef old_qDebug # undef qDebug -# define qDebug QT_QDEBUG_MACRO +# define qDebug QT_NO_QDEBUG_MACRO # undef old_qDebug # endif class QMacWindowChangeEvent; -- cgit v0.12 From 19ee05c994af7d0c55ec9e4a44e7e485eafc8c66 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 23 Jun 2010 09:20:54 +0100 Subject: Updated UIDs for spectrum demo Resolving UID clash with other example apps Reviewed-by: Miikka Heikkinen --- demos/spectrum/3rdparty/fftreal/fftreal.pro | 2 +- demos/spectrum/app/app.pro | 2 +- demos/spectrum/spectrum.pro | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/demos/spectrum/3rdparty/fftreal/fftreal.pro b/demos/spectrum/3rdparty/fftreal/fftreal.pro index 8d9f46e..6801b42 100644 --- a/demos/spectrum/3rdparty/fftreal/fftreal.pro +++ b/demos/spectrum/3rdparty/fftreal/fftreal.pro @@ -29,7 +29,7 @@ DEFINES += FFTREAL_LIBRARY symbian { # Provide unique ID for the generated binary, required by Symbian OS - TARGET.UID3 = 0xA000E3FB + TARGET.UID3 = 0xA000E403 TARGET.CAPABILITY = UserEnvironment } else { macx { diff --git a/demos/spectrum/app/app.pro b/demos/spectrum/app/app.pro index db9a144..22ee3b1 100644 --- a/demos/spectrum/app/app.pro +++ b/demos/spectrum/app/app.pro @@ -48,7 +48,7 @@ symbian { TARGET.CAPABILITY = UserEnvironment # Provide unique ID for the generated binary, required by Symbian OS - TARGET.UID3 = 0xA000E3FA + TARGET.UID3 = 0xA000E402 } diff --git a/demos/spectrum/spectrum.pro b/demos/spectrum/spectrum.pro index a8f09de..12bdec1 100644 --- a/demos/spectrum/spectrum.pro +++ b/demos/spectrum/spectrum.pro @@ -21,7 +21,7 @@ symbian { include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) # UID for the SIS file - TARGET.UID3 = 0xA000E3FA + TARGET.UID3 = 0xA000E402 } sources.files = README.txt spectrum.pri spectrum.pro TODO.txt -- cgit v0.12 From 50846a87e82fa94753bd369d03c9ba00108a12de Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 23 Jun 2010 12:20:29 +0100 Subject: Allow TLW translucency on Symbian without Qt::FramelessWindowHint This flag is Windows-specific, and should not be required on other platforms. Reviewed-by: Jason Barron --- src/gui/kernel/qwidget_s60.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 86b858d..46f3254 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -738,9 +738,6 @@ void QWidgetPrivate::s60UpdateIsOpaque() if (!q->testAttribute(Qt::WA_WState_Created) || !q->testAttribute(Qt::WA_TranslucentBackground)) return; - if ((data.window_flags & Qt::FramelessWindowHint) == 0) - return; - RWindow *const window = static_cast(q->effectiveWinId()->DrawableWindow()); #ifdef Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE -- cgit v0.12 From b60be84ad8121f9562f1ab4193136426df6dc6d4 Mon Sep 17 00:00:00 2001 From: axis Date: Thu, 24 Jun 2010 10:18:18 +0200 Subject: Fixed memory restrictions not being passed on to elf2e32. Task: QTBUG-11351 RevBy: Trust me --- mkspecs/common/symbian/symbian-makefile.conf | 2 -- mkspecs/features/symbian/symbian_building.prf | 7 +++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mkspecs/common/symbian/symbian-makefile.conf b/mkspecs/common/symbian/symbian-makefile.conf index ab0c5b9..b1ca367 100644 --- a/mkspecs/common/symbian/symbian-makefile.conf +++ b/mkspecs/common/symbian/symbian-makefile.conf @@ -14,8 +14,6 @@ QMAKE_RUN_CXX = $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $obj $src QMAKE_RUN_CXX_IMP = $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< QMAKE_ELF2E32_FLAGS = --dlldata \ - --heap=0x00020000,0x00800000 \ - --stack=0x00014000 \ --fpu=softvfp \ --unfrozen \ --compressionmethod bytepair \ diff --git a/mkspecs/features/symbian/symbian_building.prf b/mkspecs/features/symbian/symbian_building.prf index 9fc4d1e..5861bb6 100644 --- a/mkspecs/features/symbian/symbian_building.prf +++ b/mkspecs/features/symbian/symbian_building.prf @@ -8,6 +8,9 @@ QMAKE_LFLAGS += -Ttext 0x80000 -Tdata 0x400000 } +isEmpty(TARGET.EPOCSTACKSIZE):TARGET.EPOCSTACKSIZE = 0x14000 +isEmpty(TARGET.EPOCHEAPSIZE):TARGET.EPOCHEAPSIZE = 0x020000 0x800000 + symbianObjdir=$$OBJECTS_DIR isEmpty(symbianObjdir) { symbianObjdir = . @@ -114,6 +117,8 @@ contains(TEMPLATE, lib):!contains(CONFIG, static):!contains(CONFIG, staticlib) { --dso=$$symbianObjdir/$${TARGET}.dso \ --defoutput=$$symbianObjdir/$${TARGET}.def \ --linkas=$${TARGET}\\{$${hexVersion}\\}\\[$${intUid3}\\].dll \ + --heap=$$join(TARGET.EPOCHEAPSIZE, ",") \ + --stack=$$TARGET.EPOCSTACKSIZE \ $$elf2e32_LIBPATH \ $$capability \ $$QMAKE_ELF2E32_FLAGS \ @@ -163,6 +168,8 @@ contains(TEMPLATE, app):!contains(QMAKE_LINK, "^@.*") { --elfinput=$${symbianDestdir}/$${TARGET}.sym \ --output=$${symbianDestdir}/$${TARGET}.exe \ --linkas=$${TARGET}\\{$${hexVersion}\\}\\[$${intUid3}\\].exe \ + --heap=$$join(TARGET.EPOCHEAPSIZE, ",") \ + --stack=$$TARGET.EPOCSTACKSIZE \ $$elf2e32_LIBPATH \ $$capability \ $$QMAKE_ELF2E32_FLAGS \ -- cgit v0.12 From 9f7a9b1272357a06cd721d64e66fcde1921bd325 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 24 Jun 2010 10:56:08 +0200 Subject: Updated Harfbuzz from git+ssh://git.freedesktop.org/git/harfbuzz to a80fd59e3b3b18116803a14e6369345933994236 * Disable data structure packing with RVCT, as it appears that the compiler miscompiles the code. --- src/3rdparty/harfbuzz/src/harfbuzz-global.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-global.h b/src/3rdparty/harfbuzz/src/harfbuzz-global.h index 5b2b679..bccd6a2 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-global.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-global.h @@ -39,7 +39,7 @@ #define HB_END_HEADER /* nothing */ #endif -#if defined(__GNUC__) || defined(__ARMCC__) || defined(__CC_ARM) || defined(_MSC_VER) +#if defined(__GNUC__) || defined(_MSC_VER) #define HB_USE_PACKED_STRUCTS #endif -- cgit v0.12 From d8ffdacc0aa0b22a02b8ac3bae03570049b65d5d Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 24 Jun 2010 10:56:08 +0200 Subject: Updated Harfbuzz from git+ssh://git.freedesktop.org/git/harfbuzz to a80fd59e3b3b18116803a14e6369345933994236 * Disable data structure packing with RVCT, as it appears that the compiler miscompiles the code. --- src/3rdparty/harfbuzz/src/harfbuzz-global.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-global.h b/src/3rdparty/harfbuzz/src/harfbuzz-global.h index 5b2b679..bccd6a2 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-global.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-global.h @@ -39,7 +39,7 @@ #define HB_END_HEADER /* nothing */ #endif -#if defined(__GNUC__) || defined(__ARMCC__) || defined(__CC_ARM) || defined(_MSC_VER) +#if defined(__GNUC__) || defined(_MSC_VER) #define HB_USE_PACKED_STRUCTS #endif -- cgit v0.12 From 06aaa4bc68a1ee10d2a7bb8de4928c92ce84546d Mon Sep 17 00:00:00 2001 From: axis Date: Thu, 24 Jun 2010 11:58:42 +0200 Subject: Revert "Fixing race condition in qeventdispatcher_symbian.cpp code path" This reverts commit 3a9ca8ba50a63e564c15023f65cbac36d365d309. It's the wrong fix for the problem. The socket operations in the select thread are not supposed to be thread safe. It is thread safe between the select thread and the caller thread, but not if there are more than one caller thread. Ensuring complete thread safety would probably require fixes in other areas as well. The correct fix is for the client to ensure that calls to the socket registering functions are either serialized or contained within one thread. Task: QT-3496 RevBy: Aleksandar Sasha Babic --- src/corelib/kernel/qeventdispatcher_symbian.cpp | 101 ++++++++++-------------- src/corelib/kernel/qeventdispatcher_symbian_p.h | 5 -- 2 files changed, 40 insertions(+), 66 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 75b7619..d00a623 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -114,13 +114,9 @@ public: // is in select call if (m_selectCallMutex->tryLock()) { m_selectCallMutex->unlock(); - - //m_threadMutex->lock(); - //bHasThreadLock = true; return; } - char dummy = 0; qt_pipe_write(fd, &dummy, 1); @@ -409,14 +405,11 @@ void QSelectThread::run() FD_ZERO(&exceptionfds); int maxfd = 0; - { - QMutexLocker asoLocker(&m_AOStatusesMutex); - maxfd = qMax(maxfd, updateSocketSet(QSocketNotifier::Read, &readfds)); - maxfd = qMax(maxfd, updateSocketSet(QSocketNotifier::Write, &writefds)); - maxfd = qMax(maxfd, updateSocketSet(QSocketNotifier::Exception, &exceptionfds)); - maxfd = qMax(maxfd, m_pipeEnds[0]); - maxfd++; - } + maxfd = qMax(maxfd, updateSocketSet(QSocketNotifier::Read, &readfds)); + maxfd = qMax(maxfd, updateSocketSet(QSocketNotifier::Write, &writefds)); + maxfd = qMax(maxfd, updateSocketSet(QSocketNotifier::Exception, &exceptionfds)); + maxfd = qMax(maxfd, m_pipeEnds[0]); + maxfd++; FD_SET(m_pipeEnds[0], &readfds); @@ -461,42 +454,40 @@ void QSelectThread::run() FD_ZERO(&readfds); FD_ZERO(&writefds); FD_ZERO(&exceptionfds); - { - QMutexLocker asoLocker(&m_AOStatusesMutex); - for (QHash::const_iterator i = m_AOStatuses.begin(); - i != m_AOStatuses.end(); ++i) { + for (QHash::const_iterator i = m_AOStatuses.begin(); + i != m_AOStatuses.end(); ++i) { - fd_set onefds; - FD_ZERO(&onefds); - FD_SET(i.key()->socket(), &onefds); + fd_set onefds; + FD_ZERO(&onefds); + FD_SET(i.key()->socket(), &onefds); - fd_set excfds; - FD_ZERO(&excfds); - FD_SET(i.key()->socket(), &excfds); + fd_set excfds; + FD_ZERO(&excfds); + FD_SET(i.key()->socket(), &excfds); - maxfd = i.key()->socket() + 1; + maxfd = i.key()->socket() + 1; - struct timeval timeout; - timeout.tv_sec = 0; - timeout.tv_usec = 0; + struct timeval timeout; + timeout.tv_sec = 0; + timeout.tv_usec = 0; - ret = 0; + ret = 0; - if(i.key()->type() == QSocketNotifier::Read) { - ret = ::select(maxfd, &onefds, 0, &excfds, &timeout); - if(ret != 0) FD_SET(i.key()->socket(), &readfds); - } else if(i.key()->type() == QSocketNotifier::Write) { - ret = ::select(maxfd, 0, &onefds, &excfds, &timeout); - if(ret != 0) FD_SET(i.key()->socket(), &writefds); - } + if(i.key()->type() == QSocketNotifier::Read) { + ret = ::select(maxfd, &onefds, 0, &excfds, &timeout); + if(ret != 0) FD_SET(i.key()->socket(), &readfds); + } else if(i.key()->type() == QSocketNotifier::Write) { + ret = ::select(maxfd, 0, &onefds, &excfds, &timeout); + if(ret != 0) FD_SET(i.key()->socket(), &writefds); + } - } // end for + } // end for + + // traversed all, so update + updateActivatedNotifiers(QSocketNotifier::Exception, &exceptionfds); + updateActivatedNotifiers(QSocketNotifier::Read, &readfds); + updateActivatedNotifiers(QSocketNotifier::Write, &writefds); - // traversed all, so update - updateActivatedNotifiers(QSocketNotifier::Exception, &exceptionfds); - updateActivatedNotifiers(QSocketNotifier::Read, &readfds); - updateActivatedNotifiers(QSocketNotifier::Write, &writefds); - } break; case EINTR: // Should never occur on Symbian, but this is future proof! default: @@ -505,12 +496,9 @@ void QSelectThread::run() break; } } else { - { - QMutexLocker asoLocker(&m_AOStatusesMutex); - updateActivatedNotifiers(QSocketNotifier::Exception, &exceptionfds); - updateActivatedNotifiers(QSocketNotifier::Read, &readfds); - updateActivatedNotifiers(QSocketNotifier::Write, &writefds); - } + updateActivatedNotifiers(QSocketNotifier::Exception, &exceptionfds); + updateActivatedNotifiers(QSocketNotifier::Read, &readfds); + updateActivatedNotifiers(QSocketNotifier::Write, &writefds); } m_waitCond.wait(&m_mutex); @@ -529,16 +517,12 @@ void QSelectThread::requestSocketEvents ( QSocketNotifier *notifier, TRequestSta QMutexLocker locker(&m_grabberMutex); - { - // first do the thing - QMutexLocker aosLocker(&m_AOStatusesMutex); - Q_ASSERT(!m_AOStatuses.contains(notifier)); - m_AOStatuses.insert(notifier, status); - } - - // and now tell it to the others QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex, &m_selectCallMutex); + Q_ASSERT(!m_AOStatuses.contains(notifier)); + + m_AOStatuses.insert(notifier, status); + m_waitCond.wakeAll(); } @@ -546,15 +530,10 @@ void QSelectThread::cancelSocketEvents ( QSocketNotifier *notifier ) { QMutexLocker locker(&m_grabberMutex); - { - // first do the thing - QMutexLocker aosLocker(&m_AOStatusesMutex); - m_AOStatuses.remove(notifier); - } - - // and now tell it to the others QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex, &m_selectCallMutex); + m_AOStatuses.remove(notifier); + m_waitCond.wakeAll(); } diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h index 68d5833..7021314 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian_p.h +++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h @@ -231,11 +231,6 @@ private: // causes later in locking // of the thread in waitcond QMutex m_selectCallMutex; - - // Argh ... not again - // one more unprotected - // resource is m_AOStatuses - QMutex m_AOStatusesMutex; }; class Q_CORE_EXPORT CQtActiveScheduler : public CActiveScheduler -- cgit v0.12 From 7ae5285132db6c435e91ab097f41097217d68a2c Mon Sep 17 00:00:00 2001 From: axis Date: Thu, 24 Jun 2010 10:57:23 +0200 Subject: Revert "Fixing the race condition in event dispatcher implementation on" This reverts commit 5f21450a61ba2459e6dc5b08b236b15a067bf81f. It's the wrong fix for the problem. The socket operations in the select thread are not supposed to be thread safe. It is thread safe between the select thread and the caller thread, but not if there are more than one caller thread. Ensuring complete thread safety would probably require fixes in other areas as well. The correct fix is for the client to ensure that calls to the socket registering functions are either serialized or contained within one thread. Task: QT-3358 RevBy: Aleksandar Sasha Babic --- src/corelib/kernel/qeventdispatcher_symbian.cpp | 46 ++++++------------------- src/corelib/kernel/qeventdispatcher_symbian_p.h | 20 ----------- 2 files changed, 10 insertions(+), 56 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index d00a623..826caf2 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -100,40 +100,25 @@ static inline int qt_socket_select(int nfds, fd_set *readfds, fd_set *writefds, class QSelectMutexGrabber { public: - QSelectMutexGrabber(int fd, QMutex *threadMutex, QMutex *selectCallMutex) - : m_threadMutex(threadMutex), m_selectCallMutex(selectCallMutex), bHasThreadLock(false) + QSelectMutexGrabber(int fd, QMutex *mutex) + : m_mutex(mutex) { - // see if selectThread is waiting m_waitCond - // if yes ... dont write to pipe - if (m_threadMutex->tryLock()) { - bHasThreadLock = true; + if (m_mutex->tryLock()) return; - } - - // still check that SelectThread - // is in select call - if (m_selectCallMutex->tryLock()) { - m_selectCallMutex->unlock(); - return; - } char dummy = 0; qt_pipe_write(fd, &dummy, 1); - m_threadMutex->lock(); - bHasThreadLock = true; + m_mutex->lock(); } ~QSelectMutexGrabber() { - if(bHasThreadLock) - m_threadMutex->unlock(); + m_mutex->unlock(); } private: - QMutex *m_threadMutex; - QMutex *m_selectCallMutex; - bool bHasThreadLock; + QMutex *m_mutex; }; /* @@ -415,12 +400,7 @@ void QSelectThread::run() int ret; int savedSelectErrno; - { - // helps fighting the race condition between - // selctthread and new socket requests (cancel, restart ...) - QMutexLocker locker(&m_selectCallMutex); - ret = qt_socket_select(maxfd, &readfds, &writefds, &exceptionfds, 0); - } + ret = qt_socket_select(maxfd, &readfds, &writefds, &exceptionfds, 0); savedSelectErrno = errno; char buffer; @@ -515,9 +495,7 @@ void QSelectThread::requestSocketEvents ( QSocketNotifier *notifier, TRequestSta start(); } - QMutexLocker locker(&m_grabberMutex); - - QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex, &m_selectCallMutex); + QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex); Q_ASSERT(!m_AOStatuses.contains(notifier)); @@ -528,9 +506,7 @@ void QSelectThread::requestSocketEvents ( QSocketNotifier *notifier, TRequestSta void QSelectThread::cancelSocketEvents ( QSocketNotifier *notifier ) { - QMutexLocker locker(&m_grabberMutex); - - QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex, &m_selectCallMutex); + QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex); m_AOStatuses.remove(notifier); @@ -539,9 +515,7 @@ void QSelectThread::cancelSocketEvents ( QSocketNotifier *notifier ) void QSelectThread::restart() { - QMutexLocker locker(&m_grabberMutex); - - QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex, &m_selectCallMutex); + QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex); m_waitCond.wakeAll(); } diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h index 7021314..8a9c9a0 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian_p.h +++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h @@ -211,26 +211,6 @@ private: QMutex m_mutex; QWaitCondition m_waitCond; bool m_quit; - - // to protect when several - // requests like: - // requestSocketEvents - // cancelSocketEvents - // kick in the same time - // all will fight for m_mutex - // - // TODO: fix more elegantely - // - QMutex m_grabberMutex; - - // this one will tell - // if selectthread is - // really in select call - // and will prevent - // writing to pipe that - // causes later in locking - // of the thread in waitcond - QMutex m_selectCallMutex; }; class Q_CORE_EXPORT CQtActiveScheduler : public CActiveScheduler -- cgit v0.12 From 4df92b8b5e7f44d7a5e2b91f23638c92512b41f9 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Thu, 24 Jun 2010 12:45:27 +0200 Subject: Don't crash when cleaning the uninitialized fontdatabase (Symbian) Applications that do not render fonts will not cause a call to initializeDb(). In that case, there will be no creation of QSymbianFontDatabaseExtras. This fix adds a NULL-pointer check before cleaning the QSymbianFontDatabaseExtras instance. Task-number: QTBUG-11683 Reviewed-by: Miikka Heikkinen --- src/gui/text/qfontdatabase_s60.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index 5148568..0b38aab 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -162,6 +162,8 @@ void qt_cleanup_symbianFontDatabaseExtras() { const QSymbianFontDatabaseExtrasImplementation *dbExtras = static_cast(privateDb()->symbianExtras); + if (!dbExtras) + return; // initializeDb() has never been called #ifdef Q_SYMBIAN_HAS_FONTTABLE_API qDeleteAll(dbExtras->m_extrasHash); #else // Q_SYMBIAN_HAS_FONTTABLE_API -- cgit v0.12