From 284211ccbd2cbdfea46cdf4b8628a1a967271985 Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Tue, 14 Dec 2010 10:26:39 +0100 Subject: Prevent ::flush from being called on QGLWindowSurface if no painting happened. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 2527 Reviewed-by: Harald Fernengel Reviewed-by: Samuel Rødal --- src/opengl/qwindowsurface_gl.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index f64b93c..6749826 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -267,6 +267,7 @@ struct QGLWindowSurfacePrivate int tried_pb : 1; int destructive_swap_buffers : 1; int geometry_updated : 1; + int did_paint : 1; QGLContext *ctx; @@ -330,6 +331,7 @@ QGLWindowSurface::QGLWindowSurface(QWidget *window) d_ptr->glDevice.d = d_ptr; d_ptr->q_ptr = this; d_ptr->geometry_updated = false; + d_ptr->did_paint = false; } QGLWindowSurface::~QGLWindowSurface() @@ -461,6 +463,8 @@ void QGLWindowSurface::beginPaint(const QRegion &) glClearColor(0.0, 0.0, 0.0, 0.0); glClear(clearFlags); } + + d_ptr->did_paint = true; } void QGLWindowSurface::endPaint(const QRegion &rgn) @@ -513,6 +517,13 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & if (d_ptr->geometry_updated) return; + // did_paint is set to true in ::beginPaint. ::beginPaint means that we + // at least cleared the background (= painted something). In EGL API it's a + // mistakte to call swapBuffers if nothing was painted. This check protects + // the flush func from being executed if it's for nothing. + if (! d_ptr->did_paint) + return; + QWidget *parent = widget->internalWinId() ? widget : widget->nativeParentWidget(); Q_ASSERT(parent); @@ -736,6 +747,8 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & ctx->swapBuffers(); else glFlush(); + + d_ptr->did_paint = false; } -- cgit v0.12 From 4d93a606ea0438be8062fda82baf639a9ced78ba Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Tue, 14 Dec 2010 10:28:26 +0100 Subject: Trivial: Fix coding style Fix coding style of merge request --- src/opengl/qwindowsurface_gl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 6749826..7dc7dc7 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -521,7 +521,7 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & // at least cleared the background (= painted something). In EGL API it's a // mistakte to call swapBuffers if nothing was painted. This check protects // the flush func from being executed if it's for nothing. - if (! d_ptr->did_paint) + if (!d_ptr->did_paint) return; QWidget *parent = widget->internalWinId() ? widget : widget->nativeParentWidget(); -- cgit v0.12 From 0727539b89898544047d32e63633790fa0c44b5a Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 14 Dec 2010 14:03:08 +0100 Subject: Don't delete FBO when resetting glyph cache When the glyph cache is cleared because the max texture size has been exceeded, we shouldn't delete the fbo as this is only created in setContext() and will thus not be recreated. All subsequent resizing of the cache will fail. Task-number: QT-3971 Reviewed-by: Samuel --- src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index 66445cd..1b879c3 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -83,13 +83,9 @@ void QGLTextureGlyphCache::clear() if (ctx) { QGLShareContextScope scope(ctx); - if (!ctx->d_ptr->workaround_brokenFBOReadBack) - glDeleteFramebuffers(1, &m_fbo); - if (m_width || m_height) glDeleteTextures(1, &m_texture); - m_fbo = 0; m_texture = 0; m_width = 0; m_height = 0; @@ -105,6 +101,13 @@ void QGLTextureGlyphCache::clear() QGLTextureGlyphCache::~QGLTextureGlyphCache() { + if (ctx) { + QGLShareContextScope scope(ctx); + + if (!ctx->d_ptr->workaround_brokenFBOReadBack) + glDeleteFramebuffers(1, &m_fbo); + } + clear(); } -- cgit v0.12 From c031e5808ee406277a5401c69801e5c6e2ebfaea Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 15 Dec 2010 14:16:36 +1000 Subject: Fix invalid configurations being added to bearermonitor list. --- examples/network/bearermonitor/bearermonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/network/bearermonitor/bearermonitor.cpp b/examples/network/bearermonitor/bearermonitor.cpp index 75ffb01..bfa3d1f 100644 --- a/examples/network/bearermonitor/bearermonitor.cpp +++ b/examples/network/bearermonitor/bearermonitor.cpp @@ -226,7 +226,7 @@ void BearerMonitor::updateConfigurations() if (defaultConfiguration.type() == QNetworkConfiguration::ServiceNetwork) updateSnapConfiguration(defaultItem, defaultConfiguration); - } else { + } else if (defaultConfiguration.isValid()) { configurationAdded(defaultConfiguration); } -- cgit v0.12 From c9faf2defa9fa3209e44e8a5c1ae2da8e630d379 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 8 Dec 2010 17:48:14 +1000 Subject: Ensure that DBus is connected before all uses. In early system startup applications may try to use ICD before it is contactable. Ensure that the connection to ICD is established before all calls are made. If ICD is still not contactable QDBusServiceWatcher is used to monitor registration of the com.nokia.icd2 address and reconnection is attempted once ICD is started. Task-number: Maemo 199755 --- src/plugins/bearer/icd/qicdengine.cpp | 93 ++++++++++++++++++++++++++++++----- src/plugins/bearer/icd/qicdengine.h | 6 +++ 2 files changed, 88 insertions(+), 11 deletions(-) diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp index bdf4e2e..a5a183b 100644 --- a/src/plugins/bearer/icd/qicdengine.cpp +++ b/src/plugins/bearer/icd/qicdengine.cpp @@ -229,7 +229,7 @@ void IapMonitor::iapRemoved(const QString &iap_id) /******************************************************************************/ QIcdEngine::QIcdEngine(QObject *parent) -: QBearerEngine(parent), iapMonitor(0), m_dbusInterface(0), +: QBearerEngine(parent), iapMonitor(0), m_dbusInterface(0), m_icdServiceWatcher(0), firstUpdate(true), m_scanGoingOn(false) { } @@ -248,9 +248,10 @@ QNetworkConfigurationManager::Capabilities QIcdEngine::capabilities() const QNetworkConfigurationManager::NetworkSessionRequired; } -void QIcdEngine::initialize() +bool QIcdEngine::ensureDBusConnection() { - QMutexLocker locker(&mutex); + if (m_dbusInterface) + return true; // Setup DBus Interface for ICD m_dbusInterface = new QDBusInterface(ICD_DBUS_API_INTERFACE, @@ -259,9 +260,22 @@ void QIcdEngine::initialize() QDBusConnection::systemBus(), this); - // abort if cannot connect to DBus. - if (!m_dbusInterface->isValid()) - return; + if (!m_dbusInterface->isValid()) { + delete m_dbusInterface; + m_dbusInterface = 0; + + if (!m_icdServiceWatcher) { + m_icdServiceWatcher = new QDBusServiceWatcher(ICD_DBUS_API_INTERFACE, + QDBusConnection::systemBus(), + QDBusServiceWatcher::WatchForOwnerChange, + this); + + connect(m_icdServiceWatcher, SIGNAL(serviceOwnerChanged(QString,QString,QString)), + this, SLOT(icdServiceOwnerChanged(QString,QString,QString))); + } + + return false; + } connect(&m_scanTimer, SIGNAL(timeout()), this, SLOT(finishAsyncConfigurationUpdate())); m_scanTimer.setSingleShot(true); @@ -289,6 +303,19 @@ void QIcdEngine::initialize() doRequestUpdate(); getIcdInitialState(); + + return true; +} + +void QIcdEngine::initialize() +{ + QMutexLocker locker(&mutex); + + if (!ensureDBusConnection()) { + locker.unlock(); + emit updateCompleted(); + locker.relock(); + } } static inline QString network_attrs_to_security(uint network_attrs) @@ -792,6 +819,9 @@ QNetworkConfigurationPrivatePointer QIcdEngine::defaultConfiguration() { QMutexLocker locker(&mutex); + if (!ensureDBusConnection()) + return QNetworkConfigurationPrivatePointer(); + // Here we just return [ANY] request to icd and let the icd decide which IAP to connect. return userChoiceConfigurations.value(OSSO_IAP_ANY); } @@ -933,13 +963,52 @@ void QIcdEngine::connectionStateSignalsSlot(QDBusMessage msg) locker.relock(); } +void QIcdEngine::icdServiceOwnerChanged(const QString &serviceName, const QString &oldOwner, + const QString &newOwner) +{ + QMutexLocker locker(&mutex); + + if (newOwner.isEmpty()) { + // Disconnected from ICD, remove all configurations + cleanup(); + delete iapMonitor; + iapMonitor = 0; + delete m_dbusInterface; + m_dbusInterface = 0; + + QMutableHashIterator i(accessPointConfigurations); + while (i.hasNext()) { + i.next(); + + QNetworkConfigurationPrivatePointer ptr = i.value(); + i.remove(); + + locker.unlock(); + emit configurationRemoved(ptr); + locker.relock(); + } + + userChoiceConfigurations.clear(); + } else { + // Connected to ICD ensure connection. + ensureDBusConnection(); + } +} + void QIcdEngine::requestUpdate() { QMutexLocker locker(&mutex); - if (m_scanGoingOn) { + if (!ensureDBusConnection()) { + locker.unlock(); + emit updateCompleted(); + locker.relock(); return; } + + if (m_scanGoingOn) + return; + m_scanGoingOn = true; m_dbusInterface->connection().connect(ICD_DBUS_API_INTERFACE, @@ -956,14 +1025,16 @@ void QIcdEngine::requestUpdate() void QIcdEngine::cancelAsyncConfigurationUpdate() { - if (!m_scanGoingOn) { + if (!ensureDBusConnection()) return; - } + + if (!m_scanGoingOn) + return; + m_scanGoingOn = false; - if (m_scanTimer.isActive()) { + if (m_scanTimer.isActive()) m_scanTimer.stop(); - } m_dbusInterface->connection().disconnect(ICD_DBUS_API_INTERFACE, ICD_DBUS_API_PATH, diff --git a/src/plugins/bearer/icd/qicdengine.h b/src/plugins/bearer/icd/qicdengine.h index d528f15..d5b4fb3 100644 --- a/src/plugins/bearer/icd/qicdengine.h +++ b/src/plugins/bearer/icd/qicdengine.h @@ -53,6 +53,7 @@ QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; class IapMonitor; class QDBusInterface; +class QDBusServiceWatcher; inline QNetworkConfiguration::BearerType bearerTypeFromIapType(const QString &iapType) { @@ -147,12 +148,15 @@ private Q_SLOTS: void finishAsyncConfigurationUpdate(); void asyncUpdateConfigurationsSlot(QDBusMessage msg); void connectionStateSignalsSlot(QDBusMessage msg); + void icdServiceOwnerChanged(const QString &serviceName, const QString &oldOwner, + const QString &newOwner); private: void startListeningStateSignalsForAllConnections(); void doRequestUpdate(QList scanned = QList()); void cancelAsyncConfigurationUpdate(); void getIcdInitialState(); + bool ensureDBusConnection(); private: IapMonitor *iapMonitor; @@ -162,6 +166,8 @@ private: QStringList m_typesToBeScanned; QList m_scanResult; + QDBusServiceWatcher *m_icdServiceWatcher; + bool firstUpdate; bool m_scanGoingOn; }; -- cgit v0.12 From e75980a322ea1088e1c6bf60259b8ba853d32444 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 15 Dec 2010 15:30:43 +1000 Subject: Fix possible null pointer dereference. When parsing a new connection an access point with the same SSID may not have been previously seen. Task-number: QTBUG-15276 --- src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 554f9b7..f93b605 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -743,9 +743,11 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(accessPointId); - mutex.unlock(); - emit configurationRemoved(ptr); - mutex.lock(); + if (ptr) { + mutex.unlock(); + emit configurationRemoved(ptr); + mutex.lock(); + } } break; } -- cgit v0.12 From 27de60f2f6047cb3f698825af96e569fde04ef06 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 15 Dec 2010 17:06:25 +1000 Subject: Add extra type of embedded license. Marketing needs this for commercial customers. Reviewed-by: Trust Me --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 7141880..aa8d047 100755 --- a/configure +++ b/configure @@ -480,7 +480,7 @@ elif [ $COMMERCIAL_USER = "yes" ]; then # Qt All-OS LICENSE_EXTENSION="-ALLOS" ;; - 8M,* | KM,* | S9,* | SC,* | SU,* | SW,* | X9,* | XC,* | XU,* | XW,*) + 8M,* | KM,* | S9,* | SC,* | SM,* | SU,* | SW,* | X9,* | XC,* | XU,* | XW,*) # Qt for Embedded Linux LICENSE_EXTENSION="-EMBEDDED" ;; -- cgit v0.12 From 915a31420c4f8d04c82103e3dd4d33b468a9334d Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 15 Dec 2010 11:44:19 +0200 Subject: Resize event for QDesktopWidget was sent too early Some recent changes had caused a change in events sent from avkon to QSymbianControl, causing QDesktopWidget to be get resize event before the client area of application was correct. Moved the resize event sending from HandleStatusPaneSizeChange to HandleResourceChange (case KEikDynamicLayoutVariantSwitch). Task-number: QTBUG-16095 Reviewed-by: Sami Merila --- src/gui/kernel/qapplication_s60.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 81fa4e6..6db1fa8 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -667,9 +667,6 @@ void QSymbianControl::HandleStatusPaneSizeChange() { QS60MainAppUi *s60AppUi = static_cast(S60->appUi()); s60AppUi->HandleStatusPaneSizeChange(); - // Send resize event to trigger desktopwidget workAreaResized signal - QResizeEvent e(qt_desktopWidget->size(), qt_desktopWidget->size()); - QApplication::sendEvent(qt_desktopWidget, &e); } #endif @@ -1310,6 +1307,9 @@ void QSymbianControl::HandleResourceChange(int resourceType) case KEikDynamicLayoutVariantSwitch: { handleClientAreaChange(); + // Send resize event to trigger desktopwidget workAreaResized signal + QResizeEvent e(qt_desktopWidget->size(), qt_desktopWidget->size()); + QApplication::sendEvent(qt_desktopWidget, &e); break; } #endif -- cgit v0.12 From e0aa9897bc2d04054cc65dbe3452bee2ed2eacd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 15 Dec 2010 12:41:08 +0100 Subject: Prevent crash in drawhelper code when the cpu has MMXEXT but no SSE. We can't use the qdrawhelper_sse.cpp or qdrawhelper_sse3dnow.cpp when SSE is not run-time detected, as those are compiled with -msse and MMXEXT is just a subset of SSE. The compiler might choose to use an instruction not in the subset, causing a crash at run-time. Task-number: QTBUG-15693 Reviewed-by: Thiago Macieira --- src/gui/painting/qdrawhelper.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 024a69d..62af212 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -7711,17 +7711,6 @@ void qInitDrawhelperAsm() } #endif #endif // SSE -#if defined(QT_HAVE_MMXEXT) && defined(QT_HAVE_SSE) - } else if (features & MMXEXT) { - qt_memfill32 = qt_memfill32_sse; - qDrawHelper[QImage::Format_RGB16].bitmapBlit = qt_bitmapblit16_sse; -# ifdef QT_HAVE_3DNOW - if (features & MMX3DNOW) { - qt_memfill32 = qt_memfill32_sse3dnow; - qDrawHelper[QImage::Format_RGB16].bitmapBlit = qt_bitmapblit16_sse3dnow; - } -# endif // 3DNOW -#endif // MMXEXT } #ifdef QT_HAVE_MMX if (features & MMX) { -- cgit v0.12