diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-11-11 04:39:18 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-11-11 04:39:18 (GMT) |
commit | 8a2ae5245787cbfbeaf82c8f296da4d5a404db40 (patch) | |
tree | 69b11ade9c8e3476b91200c7e375a4894158dee7 /src | |
parent | 96e0af6be46e51dd3445cfbf23c09833c97c9f2c (diff) | |
parent | d3a6103783b161d6d35a00cb50fef50e73b6a4b6 (diff) | |
download | Qt-8a2ae5245787cbfbeaf82c8f296da4d5a404db40.zip Qt-8a2ae5245787cbfbeaf82c8f296da4d5a404db40.tar.gz Qt-8a2ae5245787cbfbeaf82c8f296da4d5a404db40.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1:
remove pointless assignment of deprecated variable
fix tst_headers
Fixed a shell syntax error in configure
Clear X11 structure before use
Make operator QRectF const
Fix GC-related crash in QScriptValue::setData()
get rid of dependency on QtGui
Removed implicity QtGui linking from icd.pro as it is not needed.
DFB: Make sure QPixmap::hasAlpha is respected
fix build on mingw
Fix some painting issues in QDirectFBPaintEngine
QNAM: Do not need QNetworkSession in AlwaysCache load mode
Don't crash if QScriptClass property getter returns an invalid value
QNAM: Remove dead waitForUpstreamBytesWritten() code
QNAM: Remove dead waitForDownstreamReadyRead() code
fix memleak in test
Diffstat (limited to 'src')
21 files changed, 126 insertions, 128 deletions
diff --git a/src/gui/kernel/qmotifdnd_x11.cpp b/src/gui/kernel/qmotifdnd_x11.cpp index 3334455..3b79129 100644 --- a/src/gui/kernel/qmotifdnd_x11.cpp +++ b/src/gui/kernel/qmotifdnd_x11.cpp @@ -385,7 +385,10 @@ static void DndReadSourceProperty(Display * dpy, static void DndWriteReceiverProperty(Display * dpy, Window window, unsigned char protocol_style) { - DndReceiverProp receiver_prop ; + DndReceiverProp receiver_prop; + + // squelch potential valgrind errors about uninitialized reads + memset(&receiver_prop, 0, sizeof(receiver_prop)); receiver_prop.byte_order = DndByteOrder() ; receiver_prop.protocol_version = DND_PROTOCOL_VERSION; diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index 0a0987a..05eb6cb 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -88,18 +88,6 @@ QNetworkAccessBackendFactory::~QNetworkAccessBackendFactory() QNetworkAccessBackend *QNetworkAccessManagerPrivate::findBackend(QNetworkAccessManager::Operation op, const QNetworkRequest &request) { - QNetworkRequest::CacheLoadControl mode = - static_cast<QNetworkRequest::CacheLoadControl>( - request.attribute(QNetworkRequest::CacheLoadControlAttribute, - QNetworkRequest::PreferNetwork).toInt()); - if (mode == QNetworkRequest::AlwaysCache - && (op == QNetworkAccessManager::GetOperation - || op == QNetworkAccessManager::HeadOperation)) { - QNetworkAccessBackend *backend = new QNetworkAccessCacheBackend; - backend->manager = this; - return backend; - } - if (!factoryDataShutdown) { QMutexLocker locker(&factoryData()->mutex); QNetworkAccessBackendFactoryData::ConstIterator it = factoryData()->constBegin(), diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h index 4fe6de6..7faa5cb 100644 --- a/src/network/access/qnetworkaccessbackend_p.h +++ b/src/network/access/qnetworkaccessbackend_p.h @@ -115,7 +115,6 @@ public: virtual bool start(); #endif virtual void closeDownstreamChannel() = 0; - virtual bool waitForDownstreamReadyRead(int msecs) = 0; // slot-like: virtual void downstreamReadyWrite(); diff --git a/src/network/access/qnetworkaccesscachebackend.cpp b/src/network/access/qnetworkaccesscachebackend.cpp index 73491a9..e78694e 100644 --- a/src/network/access/qnetworkaccesscachebackend.cpp +++ b/src/network/access/qnetworkaccesscachebackend.cpp @@ -132,18 +132,6 @@ void QNetworkAccessCacheBackend::closeUpstreamChannel() Q_ASSERT_X(false, Q_FUNC_INFO, "This function show not have been called!"); } -bool QNetworkAccessCacheBackend::waitForDownstreamReadyRead(int) -{ - Q_ASSERT_X(false, Q_FUNC_INFO , "This function show not have been called!"); - return false; -} - -bool QNetworkAccessCacheBackend::waitForUpstreamBytesWritten(int) -{ - Q_ASSERT_X(false, Q_FUNC_INFO, "This function show not have been called!"); - return false; -} - void QNetworkAccessCacheBackend::upstreamReadyRead() { Q_ASSERT_X(false, Q_FUNC_INFO, "This function show not have been called!"); diff --git a/src/network/access/qnetworkaccesscachebackend_p.h b/src/network/access/qnetworkaccesscachebackend_p.h index df001ab..32581d5 100644 --- a/src/network/access/qnetworkaccesscachebackend_p.h +++ b/src/network/access/qnetworkaccesscachebackend_p.h @@ -69,8 +69,6 @@ public: void open(); void closeDownstreamChannel(); void closeUpstreamChannel(); - bool waitForDownstreamReadyRead(int msecs); - bool waitForUpstreamBytesWritten(int msecs); void upstreamReadyRead(); void downstreamReadyWrite(); diff --git a/src/network/access/qnetworkaccessdebugpipebackend.cpp b/src/network/access/qnetworkaccessdebugpipebackend.cpp index cd077e7..5f99f84 100644 --- a/src/network/access/qnetworkaccessdebugpipebackend.cpp +++ b/src/network/access/qnetworkaccessdebugpipebackend.cpp @@ -278,12 +278,6 @@ void QNetworkAccessDebugPipeBackend::socketConnected() { } -bool QNetworkAccessDebugPipeBackend::waitForDownstreamReadyRead(int ms) -{ - Q_UNUSED(ms); - qCritical("QNetworkAccess: Debug pipe backend does not support waitForReadyRead()"); - return false; -} #endif diff --git a/src/network/access/qnetworkaccessdebugpipebackend_p.h b/src/network/access/qnetworkaccessdebugpipebackend_p.h index 58a4fd0..918a813 100644 --- a/src/network/access/qnetworkaccessdebugpipebackend_p.h +++ b/src/network/access/qnetworkaccessdebugpipebackend_p.h @@ -71,7 +71,6 @@ public: virtual void open(); virtual void closeDownstreamChannel(); - virtual bool waitForDownstreamReadyRead(int msecs); virtual void downstreamReadyWrite(); diff --git a/src/network/access/qnetworkaccessfilebackend.cpp b/src/network/access/qnetworkaccessfilebackend.cpp index 4560153..65f19ca 100644 --- a/src/network/access/qnetworkaccessfilebackend.cpp +++ b/src/network/access/qnetworkaccessfilebackend.cpp @@ -203,12 +203,6 @@ void QNetworkAccessFileBackend::closeDownstreamChannel() } } -bool QNetworkAccessFileBackend::waitForDownstreamReadyRead(int) -{ - Q_ASSERT(operation() == QNetworkAccessManager::GetOperation); - return readMoreFromFile(); -} - void QNetworkAccessFileBackend::downstreamReadyWrite() { Q_ASSERT_X(operation() == QNetworkAccessManager::GetOperation, "QNetworkAccessFileBackend", diff --git a/src/network/access/qnetworkaccessfilebackend_p.h b/src/network/access/qnetworkaccessfilebackend_p.h index 6df8710..d1dbe8d 100644 --- a/src/network/access/qnetworkaccessfilebackend_p.h +++ b/src/network/access/qnetworkaccessfilebackend_p.h @@ -69,7 +69,6 @@ public: virtual void open(); virtual void closeDownstreamChannel(); - virtual bool waitForDownstreamReadyRead(int msecs); virtual void downstreamReadyWrite(); diff --git a/src/network/access/qnetworkaccessftpbackend.cpp b/src/network/access/qnetworkaccessftpbackend.cpp index 1a59011..d1a18d3 100644 --- a/src/network/access/qnetworkaccessftpbackend.cpp +++ b/src/network/access/qnetworkaccessftpbackend.cpp @@ -182,23 +182,6 @@ void QNetworkAccessFtpBackend::closeDownstreamChannel() #endif } -bool QNetworkAccessFtpBackend::waitForDownstreamReadyRead(int ms) -{ - if (!ftp) - return false; - - if (ftp->bytesAvailable()) { - ftpReadyRead(); - return true; - } - - if (ms == 0) - return false; - - qCritical("QNetworkAccess: FTP backend does not support waitForReadyRead()"); - return false; -} - void QNetworkAccessFtpBackend::downstreamReadyWrite() { if (state == Transferring && ftp && ftp->bytesAvailable()) diff --git a/src/network/access/qnetworkaccessftpbackend_p.h b/src/network/access/qnetworkaccessftpbackend_p.h index 737fa72..8a2bfc3 100644 --- a/src/network/access/qnetworkaccessftpbackend_p.h +++ b/src/network/access/qnetworkaccessftpbackend_p.h @@ -87,7 +87,6 @@ public: virtual void open(); virtual void closeDownstreamChannel(); - virtual bool waitForDownstreamReadyRead(int msecs); virtual void downstreamReadyWrite(); diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index 2a0daf8..80b05a4 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -674,26 +674,6 @@ void QNetworkAccessHttpBackend::closeDownstreamChannel() // this indicates that the user closed the stream while the reply isn't finished yet } -bool QNetworkAccessHttpBackend::waitForDownstreamReadyRead(int msecs) -{ - Q_ASSERT(http); - - if (httpReply->bytesAvailable()) { - readFromHttp(); - return true; - } - - if (msecs == 0) { - // no bytes available in the socket and no waiting - return false; - } - - // ### FIXME - qCritical("QNetworkAccess: HTTP backend does not support waitForReadyRead()"); - return false; -} - - void QNetworkAccessHttpBackend::downstreamReadyWrite() { readFromHttp(); diff --git a/src/network/access/qnetworkaccesshttpbackend_p.h b/src/network/access/qnetworkaccesshttpbackend_p.h index 568b2ee..5de3429 100644 --- a/src/network/access/qnetworkaccesshttpbackend_p.h +++ b/src/network/access/qnetworkaccesshttpbackend_p.h @@ -79,7 +79,6 @@ public: virtual void open(); virtual void closeDownstreamChannel(); - virtual bool waitForDownstreamReadyRead(int msecs); virtual void downstreamReadyWrite(); virtual void setDownstreamLimited(bool b); diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index e5f4d5a..effd79e 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -54,6 +54,7 @@ #include "qnetworkaccessfilebackend_p.h" #include "qnetworkaccessdatabackend_p.h" #include "qnetworkaccessdebugpipebackend_p.h" +#include "qnetworkaccesscachebackend_p.h" #include "qfilenetworkreply_p.h" #include "QtCore/qbuffer.h" @@ -970,6 +971,26 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera return new QFileNetworkReply(this, req, op); } + // A request with QNetworkRequest::AlwaysCache does not need any bearer management + QNetworkRequest::CacheLoadControl mode = + static_cast<QNetworkRequest::CacheLoadControl>( + req.attribute(QNetworkRequest::CacheLoadControlAttribute, + QNetworkRequest::PreferNetwork).toInt()); + if (mode == QNetworkRequest::AlwaysCache + && (op == QNetworkAccessManager::GetOperation + || op == QNetworkAccessManager::HeadOperation)) { + // FIXME Implement a QNetworkReplyCacheImpl instead, see QTBUG-15106 + QNetworkReplyImpl *reply = new QNetworkReplyImpl(this); + QNetworkReplyImplPrivate *priv = reply->d_func(); + priv->manager = this; + priv->backend = new QNetworkAccessCacheBackend(); + priv->backend->manager = this->d_func(); + priv->backend->setParent(reply); + priv->backend->reply = priv; + priv->setup(op, req, outgoingData); + return reply; + } + #ifndef QT_NO_BEARERMANAGEMENT // Return a disabled network reply if network access is disabled. // Except if the scheme is empty or file://. diff --git a/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h b/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h index 46029b9..b8c1018 100644 --- a/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h +++ b/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h @@ -93,7 +93,7 @@ struct QGLRect GLfloat right; GLfloat bottom; - operator QRectF() {return QRectF(left, top, right-left, bottom-top);} + operator QRectF() const {return QRectF(left, top, right-left, bottom-top);} }; class QGL2PEXVertexArray diff --git a/src/plugins/bearer/corewlan/corewlan.pro b/src/plugins/bearer/corewlan/corewlan.pro index 922a501..9cb3955 100644 --- a/src/plugins/bearer/corewlan/corewlan.pro +++ b/src/plugins/bearer/corewlan/corewlan.pro @@ -1,7 +1,7 @@ TARGET = qcorewlanbearer include(../../qpluginbase.pri) -QT = core gui network +QT = core network LIBS += -framework Foundation -framework SystemConfiguration contains(QT_CONFIG, corewlan) { diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 844e38b..9946b17 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -64,12 +64,17 @@ #include <Foundation/NSLock.h> #include <SystemConfiguration/SCNetworkConfiguration.h> -#include <private/qt_cocoa_helpers_mac_p.h> #include "private/qcore_mac_p.h" #include <net/if.h> #include <ifaddrs.h> +inline QString qt_NSStringToQString(const NSString *nsstr) +{ return QCFString::toQString(reinterpret_cast<const CFStringRef>(nsstr)); } + +inline NSString *qt_QStringToNSString(const QString &qstr) +{ return [reinterpret_cast<const NSString *>(QCFString::toCFStringRef(qstr)) autorelease]; } + @interface QT_MANGLE_NAMESPACE(QNSListener) : NSObject { @@ -93,11 +98,12 @@ - (id) init { [locker lock]; - QMacCocoaAutoReleasePool pool; + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; notificationCenter = [NSNotificationCenter defaultCenter]; currentInterface = [CWInterface interfaceWithName:nil]; [notificationCenter addObserver:self selector:@selector(notificationHandler:) name:kCWPowerDidChangeNotification object:nil]; [locker unlock]; + [autoreleasepool release]; return self; } @@ -161,10 +167,10 @@ void QScanThread::quit() void QScanThread::run() { - QMacCocoaAutoReleasePool pool; + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; QStringList found; mutex.lock(); - CWInterface *currentInterface = [CWInterface interfaceWithName:qt_mac_QStringToNSString(interfaceName)]; + CWInterface *currentInterface = [CWInterface interfaceWithName:qt_QStringToNSString(interfaceName)]; mutex.unlock(); if([currentInterface power]) { @@ -182,14 +188,14 @@ void QScanThread::run() for(uint row=0; row < [apArray count]; row++ ) { apNetwork = [apArray objectAtIndex:row]; - const QString networkSsid = qt_mac_NSStringToQString([apNetwork ssid]); + const QString networkSsid = qt_NSStringToQString([apNetwork ssid]); const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkSsid)); found.append(id); QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined; bool known = isKnownSsid(networkSsid); if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) { - if( networkSsid == qt_mac_NSStringToQString( [currentInterface ssid])) { + if( networkSsid == qt_NSStringToQString( [currentInterface ssid])) { state = QNetworkConfiguration::Active; } } @@ -232,7 +238,7 @@ void QScanThread::run() } if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) { - if( networkSsid == qt_mac_NSStringToQString([currentInterface ssid])) { + if( networkSsid == qt_NSStringToQString([currentInterface ssid])) { state = QNetworkConfiguration::Active; } } @@ -251,6 +257,7 @@ void QScanThread::run() } } emit networksChanged(); + [autoreleasepool release]; } QStringList QScanThread::foundNetwork(const QString &id, const QString &name, const QNetworkConfiguration::StateFlags state, const QString &interfaceName, const QNetworkConfiguration::Purpose purpose) @@ -290,7 +297,7 @@ void QScanThread::getUserConfigurations() { QMutexLocker locker(&mutex); - QMacCocoaAutoReleasePool pool; + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; userProfiles.clear(); NSArray *wifiInterfaces = [CWInterface supportedInterfaces]; @@ -310,10 +317,10 @@ void QScanThread::getUserConfigurations() NSArray *thisSsidarray = [prefNetDict valueForKey:@"SSID_STR"]; for(NSString *ssidkey in thisSsidarray) { - QString thisSsid = qt_mac_NSStringToQString(ssidkey); + QString thisSsid = qt_NSStringToQString(ssidkey); if(!userProfiles.contains(thisSsid)) { QMap <QString,QString> map; - map.insert(thisSsid, qt_mac_NSStringToQString(nsInterfaceName)); + map.insert(thisSsid, qt_NSStringToQString(nsInterfaceName)); userProfiles.insert(thisSsid, map); } } @@ -322,7 +329,7 @@ void QScanThread::getUserConfigurations() // 802.1X user profiles QString userProfilePath = QDir::homePath() + "/Library/Preferences/com.apple.eap.profiles.plist"; - NSDictionary* eapDict = [[[NSDictionary alloc] initWithContentsOfFile:qt_mac_QStringToNSString(userProfilePath)] autorelease]; + NSDictionary* eapDict = [[[NSDictionary alloc] initWithContentsOfFile:qt_QStringToNSString(userProfilePath)] autorelease]; if(eapDict != nil) { NSString *profileStr= @"Profiles"; NSString *nameStr = @"UserDefinedName"; @@ -341,15 +348,15 @@ void QScanThread::getUserConfigurations() QString ssid; for(int i = 0; i < dictSize; i++) { if([nameStr isEqualToString:keys[i]]) { - networkName = qt_mac_NSStringToQString(objects[i]); + networkName = qt_NSStringToQString(objects[i]); } if([networkSsidStr isEqualToString:keys[i]]) { - ssid = qt_mac_NSStringToQString(objects[i]); + ssid = qt_NSStringToQString(objects[i]); } if(!userProfiles.contains(networkName) && !ssid.isEmpty()) { QMap<QString,QString> map; - map.insert(ssid, qt_mac_NSStringToQString(nsInterfaceName)); + map.insert(ssid, qt_NSStringToQString(nsInterfaceName)); userProfiles.insert(networkName, map); } } @@ -358,6 +365,7 @@ void QScanThread::getUserConfigurations() } } } + [autoreleasepool release]; } QString QScanThread::getSsidFromNetworkName(const QString &name) @@ -434,7 +442,7 @@ QCoreWlanEngine::~QCoreWlanEngine() void QCoreWlanEngine::initialize() { QMutexLocker locker(&mutex); - QMacCocoaAutoReleasePool pool; + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; if([[CWInterface supportedInterfaces] count] > 0 && !listener) { listener = [[QT_MANGLE_NAMESPACE(QNSListener) alloc] init]; @@ -446,6 +454,7 @@ void QCoreWlanEngine::initialize() storeSession = NULL; startNetworkChangeLoop(); + [autoreleasepool release]; } @@ -466,11 +475,11 @@ bool QCoreWlanEngine::hasIdentifier(const QString &id) void QCoreWlanEngine::connectToId(const QString &id) { QMutexLocker locker(&mutex); - QMacCocoaAutoReleasePool pool; + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; QString interfaceString = getInterfaceFromId(id); CWInterface *wifiInterface = - [CWInterface interfaceWithName: qt_mac_QStringToNSString(interfaceString)]; + [CWInterface interfaceWithName: qt_QStringToNSString(interfaceString)]; if ([wifiInterface power]) { NSError *err = nil; @@ -488,9 +497,9 @@ void QCoreWlanEngine::connectToId(const QString &id) NSArray *array = [CW8021XProfile allUser8021XProfiles]; for (NSUInteger i = 0; i < [array count]; ++i) { - const QString networkNameHashCheck = QString::number(qHash(QLatin1String("corewlan:") + qt_mac_NSStringToQString([[array objectAtIndex:i] userDefinedName]))); + const QString networkNameHashCheck = QString::number(qHash(QLatin1String("corewlan:") + qt_NSStringToQString([[array objectAtIndex:i] userDefinedName]))); - const QString ssidHash = QString::number(qHash(QLatin1String("corewlan:") + qt_mac_NSStringToQString([[array objectAtIndex:i] ssid]))); + const QString ssidHash = QString::number(qHash(QLatin1String("corewlan:") + qt_NSStringToQString([[array objectAtIndex:i] ssid]))); if (id == networkNameHashCheck || id == ssidHash) { const QString thisName = scanThread->getSsidFromNetworkName(id); @@ -523,7 +532,7 @@ void QCoreWlanEngine::connectToId(const QString &id) [NSNumber numberWithBool:YES], kCWScanKeyMerge, [NSNumber numberWithInt:kCWScanTypeFast], kCWScanKeyScanType, [NSNumber numberWithInteger:100], kCWScanKeyRestTime, - qt_mac_QStringToNSString(wantedSsid), kCWScanKeySSID, + qt_QStringToNSString(wantedSsid), kCWScanKeySSID, nil]; NSArray *scanArray = [wifiInterface scanForNetworksWithParameters:scanParameters error:&err]; @@ -532,7 +541,7 @@ void QCoreWlanEngine::connectToId(const QString &id) for(uint row=0; row < [scanArray count]; row++ ) { CWNetwork *apNetwork = [scanArray objectAtIndex:row]; - if(wantedSsid == qt_mac_NSStringToQString([apNetwork ssid])) { + if(wantedSsid == qt_NSStringToQString([apNetwork ssid])) { if(!using8021X) { SecKeychainAttribute attributes[3]; @@ -599,18 +608,19 @@ void QCoreWlanEngine::connectToId(const QString &id) return; } } else { - qDebug() <<"associate ERROR"<< qt_mac_NSStringToQString([err localizedDescription ]); + qDebug() <<"associate ERROR"<< qt_NSStringToQString([err localizedDescription ]); } } } //end scan network } else { - qDebug() <<"scan ERROR"<< qt_mac_NSStringToQString([err localizedDescription ]); + qDebug() <<"scan ERROR"<< qt_NSStringToQString([err localizedDescription ]); } emit connectionError(id, InterfaceLookupError); } locker.unlock(); emit connectionError(id, InterfaceLookupError); + [autoreleasepool release]; } void QCoreWlanEngine::disconnectFromId(const QString &id) @@ -618,10 +628,10 @@ void QCoreWlanEngine::disconnectFromId(const QString &id) QMutexLocker locker(&mutex); QString interfaceString = getInterfaceFromId(id); - QMacCocoaAutoReleasePool pool; + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; CWInterface *wifiInterface = - [CWInterface interfaceWithName: qt_mac_QStringToNSString(interfaceString)]; + [CWInterface interfaceWithName: qt_QStringToNSString(interfaceString)]; [wifiInterface disassociate]; if ([[wifiInterface interfaceState]intValue] != kCWInterfaceStateInactive) { @@ -629,6 +639,7 @@ void QCoreWlanEngine::disconnectFromId(const QString &id) emit connectionError(id, DisconnectionError); locker.relock(); } + [autoreleasepool release]; } void QCoreWlanEngine::requestUpdate() @@ -641,27 +652,30 @@ void QCoreWlanEngine::doRequestUpdate() { QMutexLocker locker(&mutex); - QMacCocoaAutoReleasePool pool; + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; NSArray *wifiInterfaces = [CWInterface supportedInterfaces]; for (uint row = 0; row < [wifiInterfaces count]; ++row) { - scanThread->interfaceName = qt_mac_NSStringToQString([wifiInterfaces objectAtIndex:row]); + scanThread->interfaceName = qt_NSStringToQString([wifiInterfaces objectAtIndex:row]); scanThread->start(); } locker.unlock(); + [autoreleasepool release]; } bool QCoreWlanEngine::isWifiReady(const QString &wifiDeviceName) { QMutexLocker locker(&mutex); - + bool haswifi = false; if(hasWifi) { - QMacCocoaAutoReleasePool pool; - CWInterface *defaultInterface = [CWInterface interfaceWithName: qt_mac_QStringToNSString(wifiDeviceName)]; - if([defaultInterface power]) - return true; + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; + CWInterface *defaultInterface = [CWInterface interfaceWithName: qt_QStringToNSString(wifiDeviceName)]; + if([defaultInterface power]) { + haswifi = true; + } + [autoreleasepool release]; } - return false; + return haswifi; } @@ -853,7 +867,7 @@ quint64 QCoreWlanEngine::bytesReceived(const QString &id) quint64 QCoreWlanEngine::startTime(const QString &id) { QMutexLocker locker(&mutex); - QMacCocoaAutoReleasePool pool; + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; quint64 timestamp = 0; NSString *filePath = @"/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist"; @@ -884,7 +898,7 @@ quint64 QCoreWlanEngine::startTime(const QString &id) bool ok = false; for(int i = 0; i < dictSize; i++) { if([ssidStr isEqualToString:keys[i]]) { - const QString ident = QString::number(qHash(QLatin1String("corewlan:") + qt_mac_NSStringToQString(objects[i]))); + const QString ident = QString::number(qHash(QLatin1String("corewlan:") + qt_NSStringToQString(objects[i]))); if(ident == id) { ok = true; } @@ -900,6 +914,7 @@ quint64 QCoreWlanEngine::startTime(const QString &id) } } } + [autoreleasepool release]; return timestamp; } diff --git a/src/plugins/bearer/icd/icd.pro b/src/plugins/bearer/icd/icd.pro index 464cc1c..6700cda 100644 --- a/src/plugins/bearer/icd/icd.pro +++ b/src/plugins/bearer/icd/icd.pro @@ -1,7 +1,7 @@ TARGET = qicdbearer include(../../qpluginbase.pri) -QT += network dbus +QT = core network dbus QMAKE_CXXFLAGS *= $$QT_CFLAGS_DBUS $$QT_CFLAGS_CONNSETTINGS LIBS += $$QT_LIBS_CONNSETTINGS diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 4869eba..c16a242 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -55,6 +55,7 @@ #include <private/qpixmap_raster_p.h> #include <private/qimagepixmapcleanuphooks_p.h> + QT_BEGIN_NAMESPACE class SurfaceCache; @@ -112,7 +113,11 @@ public: static inline int cacheCost(const QImage &img) { return img.width() * img.height() * img.depth() / 8; } #endif - void prepareForBlit(bool alpha); + enum BlitFlag { + HasAlpha = 0x1, + Premultiplied = 0x2 + }; + void prepareForBlit(uint blitFlags); IDirectFBSurface *surface; @@ -616,7 +621,12 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image, #if !defined QT_NO_DIRECTFB_PREALLOCATED || defined QT_DIRECTFB_IMAGECACHE bool release; IDirectFBSurface *imgSurface = d->getSurface(image, &release); - d->prepareForBlit(QDirectFBScreen::hasAlphaChannel(imgSurface)); + uint blitFlags = 0; + if (image.hasAlphaChannel()) + blitFlags |= QDirectFBPaintEnginePrivate::HasAlpha; + if (QDirectFBScreen::isPremultiplied(image.format())) + blitFlags |= QDirectFBPaintEnginePrivate::Premultiplied; + d->prepareForBlit(blitFlags); CLIPPED_PAINT(d->blit(r, imgSurface, sr)); if (release) { #if (Q_DIRECTFB_VERSION >= 0x010000) @@ -655,8 +665,14 @@ void QDirectFBPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap, QRasterPaintEngine::drawImage(r, *img, sr); } else { QDirectFBPaintEnginePrivate::unlock(dfbData); - d->prepareForBlit(pixmap.hasAlphaChannel()); IDirectFBSurface *s = dfbData->directFBSurface(); + uint blitFlags = 0; + if (pixmap.hasAlphaChannel()) + blitFlags |= QDirectFBPaintEnginePrivate::HasAlpha; + if (QDirectFBScreen::isPremultiplied(dfbData->pixelFormat())) + blitFlags |= QDirectFBPaintEnginePrivate::Premultiplied; + + d->prepareForBlit(blitFlags); CLIPPED_PAINT(d->blit(r, s, sr)); } } @@ -978,7 +994,7 @@ void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode m break; case QPainter::CompositionMode_SourceOver: compositionModeStatus &= ~PorterDuff_AlwaysBlend; - surface->SetPorterDuff(surface, DSPD_NONE); + surface->SetPorterDuff(surface, DSPD_SRC_OVER); break; case QPainter::CompositionMode_DestinationOver: surface->SetPorterDuff(surface, DSPD_DST_OVER); @@ -1031,13 +1047,18 @@ void QDirectFBPaintEnginePrivate::setRenderHints(QPainter::RenderHints hints) } } -void QDirectFBPaintEnginePrivate::prepareForBlit(bool alpha) +void QDirectFBPaintEnginePrivate::prepareForBlit(uint flags) { - DFBSurfaceBlittingFlags blittingFlags = alpha ? DSBLIT_BLEND_ALPHACHANNEL : DSBLIT_NOFX; + DFBSurfaceBlittingFlags blittingFlags = DSBLIT_NOFX; + if (flags & Premultiplied) + blittingFlags |= DSBLIT_SRC_PREMULTIPLY; + if (flags & HasAlpha) + blittingFlags |= DSBLIT_BLEND_ALPHACHANNEL; if (opacity != 255) { blittingFlags |= DSBLIT_BLEND_COLORALPHA; + surface->SetColor(surface, 0xff, 0xff, 0xff, opacity); } - surface->SetColor(surface, 0xff, 0xff, 0xff, opacity); + surface->SetBlittingFlags(surface, blittingFlags); } @@ -1154,13 +1175,18 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPix QPointF offset = off; Q_ASSERT(transform.type() <= QTransform::TxScale); - prepareForBlit(pixmap.hasAlphaChannel()); QPixmapData *data = pixmap.pixmapData(); Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data); + IDirectFBSurface *sourceSurface = dfbData->directFBSurface(); + uint blitFlags = 0; + if (dfbData->hasAlphaChannel()) + blitFlags |= HasAlpha; + if (QDirectFBScreen::isPremultiplied(dfbData->pixelFormat())) + blitFlags |= Premultiplied; + prepareForBlit(blitFlags); QDirectFBPaintEnginePrivate::unlock(dfbData); const QSize pixmapSize = dfbData->size(); - IDirectFBSurface *sourceSurface = dfbData->directFBSurface(); if (transform.isScaling()) { Q_ASSERT(supportsStretchBlit()); Q_ASSERT(qMin(transform.m11(), transform.m22()) >= 0); diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index f494106..e40458b 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -2036,6 +2036,7 @@ void QScriptValue::setData(const QScriptValue &data) Q_D(QScriptValue); if (!d || !d->isObject()) return; + QScript::APIShim shim(d->engine); JSC::JSValue other = d->engine->scriptValueToJSCValue(data); if (d->jscValue.inherits(&QScriptObject::info)) { QScriptObject *scriptObject = static_cast<QScriptObject*>(JSC::asObject(d->jscValue)); diff --git a/src/script/bridge/qscriptclassobject.cpp b/src/script/bridge/qscriptclassobject.cpp index dd229f1..228e755 100644 --- a/src/script/bridge/qscriptclassobject.cpp +++ b/src/script/bridge/qscriptclassobject.cpp @@ -78,6 +78,12 @@ bool ClassObjectDelegate::getOwnPropertySlot(QScriptObject* object, scriptObject, scriptName, QScriptClass::HandlesReadAccess, &id); if (flags & QScriptClass::HandlesReadAccess) { QScriptValue value = m_scriptClass->property(scriptObject, scriptName, id); + if (!value.isValid()) { + // The class claims to have the property, but returned an invalid + // value. Silently convert to undefined to avoid the invalid value + // "escaping" into JS. + value = QScriptValue(QScriptValue::UndefinedValue); + } slot.setValue(engine->scriptValueToJSCValue(value)); return true; } @@ -119,6 +125,12 @@ bool ClassObjectDelegate::getOwnPropertyDescriptor(QScriptObject *object, attribs |= pflags & QScriptValue::UserRange; // Rather than calling the getter, we could return an access descriptor here. QScriptValue value = m_scriptClass->property(scriptObject, scriptName, id); + if (!value.isValid()) { + // The class claims to have the property, but returned an invalid + // value. Silently convert to undefined to avoid the invalid value + // "escaping" into JS. + value = QScriptValue(QScriptValue::UndefinedValue); + } descriptor.setDescriptor(engine->scriptValueToJSCValue(value), attribs); return true; } |