From c6c0eb084ab31768c7d16d00b3cb14a30ee71918 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 18 Sep 2014 17:43:21 +0200 Subject: Document non-intuitive behavior of QTreeWidgetItem::setHidden(). Task-number: QTBUG-30366 Change-Id: I02e098fbf0e3a44794ed0e1b1bf533c1c9ad5632 Reviewed-by: Jerome Pasion --- src/widgets/itemviews/qtreewidget.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index cd57b5828a..6b9ccf5043 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -1010,6 +1010,9 @@ void QTreeModel::timerEvent(QTimerEvent *ev) \since 4.2 Hides the item if \a hide is true, otherwise shows the item. + \note A call to this function has no effect if the item is not currently in a view. In particular, + calling \c setHidden(true) on an item and only then adding it to a view will result in + a visible item. \sa isHidden() */ -- cgit v1.2.3 From a966b19b520cdbcc515ed90fe5e544d6f58af9ec Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Thu, 18 Sep 2014 17:59:51 +0200 Subject: Fix crash in QNetworkAccessCacheBackend::closeDownstreamChannel device is private, always null and class has no friends, so no need to have it at all Change-Id: I320d47f1a712a3202c08b494563533e29d185501 Reviewed-by: Lars Knoll Reviewed-by: Richard J. Moore --- src/network/access/qnetworkaccesscachebackend.cpp | 6 ------ src/network/access/qnetworkaccesscachebackend_p.h | 1 - 2 files changed, 7 deletions(-) (limited to 'src') diff --git a/src/network/access/qnetworkaccesscachebackend.cpp b/src/network/access/qnetworkaccesscachebackend.cpp index 890032fe47..ea3d6b0cce 100644 --- a/src/network/access/qnetworkaccesscachebackend.cpp +++ b/src/network/access/qnetworkaccesscachebackend.cpp @@ -52,7 +52,6 @@ QT_BEGIN_NAMESPACE QNetworkAccessCacheBackend::QNetworkAccessCacheBackend() : QNetworkAccessBackend() - , device(0) { } @@ -125,11 +124,6 @@ bool QNetworkAccessCacheBackend::sendCacheContents() void QNetworkAccessCacheBackend::closeDownstreamChannel() { - if (operation() == QNetworkAccessManager::GetOperation) { - device->close(); - delete device; - device = 0; - } } void QNetworkAccessCacheBackend::closeUpstreamChannel() diff --git a/src/network/access/qnetworkaccesscachebackend_p.h b/src/network/access/qnetworkaccesscachebackend_p.h index 69765e893e..58f5aac83f 100644 --- a/src/network/access/qnetworkaccesscachebackend_p.h +++ b/src/network/access/qnetworkaccesscachebackend_p.h @@ -75,7 +75,6 @@ public: private: bool sendCacheContents(); - QIODevice *device; }; -- cgit v1.2.3 From 5d688c5780b2b7e61630e26100f0932d33513291 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Mon, 22 Sep 2014 09:47:26 +0200 Subject: Add backslash to the list of word separator. Task-number: QTBUG-40384 Change-Id: I16ae1432f3bdd7e577593fc43336bf29c735a66b Reviewed-by: Konstantin Ritt Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qtextengine.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index fcf1a1468c..8e2b90033c 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2449,6 +2449,7 @@ bool QTextEngine::atWordSeparator(int position) const case '`': case '~': case '|': + case '\\': return true; default: break; -- cgit v1.2.3 From 87fbfe074bf78506b3994ccd5c1c4b82ce2b6a71 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sat, 20 Sep 2014 18:22:59 +0200 Subject: Fix a mishandling of the fd returned by socket(2) socket(2) is allowed to return 0, so 0 should not be included when checking for errors. Change-Id: I0454ea60347d90078d3ab3046969add8d5c37935 Reviewed-by: Marc Mutz Reviewed-by: Richard J. Moore Reviewed-by: Thiago Macieira --- src/network/socket/qnativesocketengine_unix.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index 65244ce9cf..ebfb2a2793 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -147,13 +147,13 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc int type = (socketType == QAbstractSocket::UdpSocket) ? SOCK_DGRAM : SOCK_STREAM; int socket = qt_safe_socket(protocol, type, 0); - if (socket <= 0 && socketProtocol == QAbstractSocket::AnyIPProtocol && errno == EAFNOSUPPORT) { + if (socket < 0 && socketProtocol == QAbstractSocket::AnyIPProtocol && errno == EAFNOSUPPORT) { protocol = AF_INET; socket = qt_safe_socket(protocol, type, 0); socketProtocol = QAbstractSocket::IPv4Protocol; } - if (socket <= 0) { + if (socket < 0) { switch (errno) { case EPROTONOSUPPORT: case EAFNOSUPPORT: -- cgit v1.2.3 From 65a991e57e862e498fcae741f03ba1727a76fc80 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 18 Sep 2014 17:37:23 +0200 Subject: Make sure we don't delete child QWindows if they have WA_NativeWindow set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Deleting a QWindow automatically deletes its child windows because they are in the QObject hierarchy. However, if the user sets both WA_NativeWindow and WA_DontCreateNativeAncestors, we can't just delete that widget's QWindow. First because the widget doesn't get notified (and maybe it should be), and then because we may invalidate any reference to the QWindow the user may have kept. Our solution is to reparent the child QWindows into the new parent's closest QWindow. We must, however, take the precaution of not keeping any reference to the backing store in the platform window. Reparenting operations can trigger repaints on the platform window, but the backing store is not set and flushed until later. Task-number: QTBUG-38377 Change-Id: I353f5528f227a227b6d10419367cbe1d5d07a94e Reviewed-by: Jørgen Lind --- src/plugins/platforms/cocoa/qnsview.mm | 2 ++ src/widgets/kernel/qwidget_qpa.cpp | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 86691456b8..a4671845b7 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -580,6 +580,8 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; CGImageRelease(subMask); [self invalidateWindowShadowIfNeeded]; + + m_backingStore = 0; } - (BOOL) isFlipped diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index 5a4bd33672..b734307d40 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -284,6 +284,22 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) if (wasCreated && !(f & Qt::Window) && (oldFlags & Qt::Window) && !q->testAttribute(Qt::WA_NativeWindow)) { if (extra && extra->hasWindowContainer) QWindowContainer::toplevelAboutToBeDestroyed(q); + + QWindow *newParentWindow = newparent->windowHandle(); + if (!newParentWindow) + if (QWidget *npw = newparent->nativeParentWidget()) + newParentWindow = npw->windowHandle(); + + Q_FOREACH (QObject *child, q->windowHandle()->children()) { + QWindow *childWindow = qobject_cast(child); + if (!childWindow) + continue; + + QWidgetWindow *childWW = qobject_cast(childWindow); + QWidget *childWidget = childWW ? childWW->widget() : 0; + if (!childWW || (childWidget && childWidget->testAttribute(Qt::WA_NativeWindow))) + childWindow->setParent(newParentWindow); + } q->destroy(); } -- cgit v1.2.3 From 412ec70f14aa0c966d13481a35c498e6c905dec3 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 18 Sep 2014 19:12:17 +0200 Subject: OS X: Fix menu item shortcuts without modifiers A regression was introduced by bdebec4e2ef79f1771d2dcc22f9a919eb4487567. The intention of the change was to avoid using Qt's shortcut mechanism to trigger menu items which were already triggered through the regular menu API in Cocoa. However, Cocoa has trouble with key equivalents that do not have any keyboard modifiers. Thus, we have to allow these particular key sequences to go through the regular system. I've verified that the original bug is still fixed with this change. [ChangeLog][OS X] Fixed menu item shortcuts without keyboard modifiers. Task-number: QTBUG-41192 Change-Id: I8f5a9cbc7a448b3cb0519baed95be5cbb630205c Reviewed-by: Gabriel de Dietrich --- src/widgets/kernel/qshortcut.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp index dcf6aed591..3683d6c7ce 100644 --- a/src/widgets/kernel/qshortcut.cpp +++ b/src/widgets/kernel/qshortcut.cpp @@ -279,7 +279,7 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge // (and reaches this point), then the menu item itself has been disabled. // This occurs at the QPA level on Mac, were we disable all the Cocoa menus // when showing a modal window. - if (a->shortcut().count() <= 1) + if (a->shortcut().count() < 1 || (a->shortcut().count() == 1 && (a->shortcut()[0] & Qt::MODIFIER_MASK) != 0)) continue; #endif QAction *a = menu->menuAction(); -- cgit v1.2.3 From da0c74550f0e8a21239896d6aead6e05f85eb695 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Tue, 1 Jul 2014 10:31:07 +0200 Subject: OS X: main window doesn't become key. When ordering a key window out Cocoa tries to find a new KEY window. Looks like it prefers the current MAIN window and since QNSPanel is never a main window, Cocoa is breaking the stack order. To avoid this - try to change the key window BEFORE ordering out a window. The application has a stack of all open windows (visible and hidden), we iterate through this stack starting from our current key window and look for the nearest window below, that can become a new key window. Most probably, it will be our transient parent :) This code will change (potentially) the key window _only_ if there is a transient parent. Task-number: QTBUG-39809 Change-Id: I96b630799341875fc7e38dabf1ff6416338e687b Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoawindow.mm | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 4d0458a4aa..19d0f7a987 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -80,6 +80,32 @@ static bool isMouseEvent(NSEvent *ev) } } +static void selectNextKeyWindow(NSWindow *currentKeyWindow) +{ + if (!currentKeyWindow) + return; + + const QCocoaAutoReleasePool pool; + + if ([[NSApplication sharedApplication] keyWindow] != currentKeyWindow) + return;//currentKeyWindow is not a key window actually. + + NSArray *const windows = [[NSApplication sharedApplication] windows]; + bool startLookup = false; + for (NSWindow *candidate in [windows reverseObjectEnumerator]) { + if (!startLookup) { + if (candidate == currentKeyWindow) + startLookup = true; + } else { + if ([candidate isVisible] && [candidate canBecomeKeyWindow]) { + [candidate makeKeyWindow]; + break; + } + } + } +} + + @interface NSWindow (CocoaWindowCategory) - (NSRect) legacyConvertRectFromScreen:(NSRect) rect; @end @@ -588,6 +614,9 @@ void QCocoaWindow::hide(bool becauseOfAncestor) foreach (QCocoaWindow *childWindow, m_childWindows) childWindow->hide(true); + if (window()->transientParent() && m_nsWindow == [[NSApplication sharedApplication] keyWindow]) + selectNextKeyWindow(m_nsWindow); // Otherwise, Cocoa can do it wrong. + [m_nsWindow orderOut:nil]; } -- cgit v1.2.3 From b4af1235eff3c7b23fdc5534453a45aa3db70e5e Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 15 Sep 2014 19:41:42 +0200 Subject: OS X: File dialog does not show "Media" section. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This bug can be reproduced (AFAIK) only on 10.9. To fix it I suggest we create NSOpenPanel/NSSavePanel _every_ time it must be displayed. Actually, that's what I've seen in all code samples I was able to found - nobody tries to retain this panel and re-use it. If we re-use it, "Media" section magically disappears. I believe this bug is not Qt's bug, but something weird in Cocoa. Task-number: QTBUG-40655 Change-Id: Ic0e76e0a9a5444a76f336d511c0ff93f9fd05797 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 2b7b8109ad..a47b28700c 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -712,9 +712,8 @@ bool QCocoaFileDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModalit void QCocoaFileDialogHelper::createNSOpenSavePanelDelegate() { - if (mDelegate) - return; QCocoaAutoReleasePool pool; + const SharedPointerFileDialogOptions &opts = options(); const QList selectedFiles = opts->initiallySelectedFiles(); const QUrl directory = mDir.isEmpty() ? opts->initialDirectory() : mDir; @@ -726,6 +725,7 @@ void QCocoaFileDialogHelper::createNSOpenSavePanelDelegate() options:opts helper:this]; + [static_cast(mDelegate) release]; mDelegate = delegate; } -- cgit v1.2.3 From 8259413e410b4291d1cef319c90718ff853a3ffc Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sun, 21 Sep 2014 19:38:37 +0200 Subject: GTK syle: initialize all members of GdkColor Coverity rightfully complains that we're copying a struct with an uninitialized member, triggering undefined behavior. Change-Id: I7635b859eb11e5eb9b825df8e23b453116059892 Reviewed-by: J-P Nurmi --- src/widgets/styles/qgtkstyle.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/widgets/styles/qgtkstyle.cpp b/src/widgets/styles/qgtkstyle.cpp index 9fa056960a..8ca6898b3d 100644 --- a/src/widgets/styles/qgtkstyle.cpp +++ b/src/widgets/styles/qgtkstyle.cpp @@ -297,6 +297,7 @@ static QColor mergedColors(const QColor &colorA, const QColor &colorB, int facto static GdkColor fromQColor(const QColor &color) { GdkColor retval; + retval.pixel = 0; retval.red = color.red() * 255; retval.green = color.green() * 255; retval.blue = color.blue() * 255; -- cgit v1.2.3 From ebdd56c5bd4b5115f9626561123ac740dc874ade Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sun, 21 Sep 2014 11:12:58 +0200 Subject: XCB: fix a memory leak An early return caused a leak of a new'd allocated object. Change-Id: I9fbc37238dd49066d24363a2e8ee8bf35b155301 Reviewed-by: Uli Schlachter Reviewed-by: Allan Sandfeld Jensen --- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index b38f9d42a9..643a0351e3 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -335,8 +335,10 @@ XInput2DeviceData *QXcbConnection::deviceForId(int id) QTouchDevice::Capabilities caps = 0; dev = new XInput2DeviceData; dev->xiDeviceInfo = XIQueryDevice(static_cast(m_xlib_display), id, &nrDevices); - if (nrDevices <= 0) + if (nrDevices <= 0) { + delete dev; return 0; + } int type = -1; int maxTouchPoints = 1; bool hasRelativeCoords = false; -- cgit v1.2.3 From 772b799a83e72382d5594cf0eca8a01d42e4002e Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sat, 20 Sep 2014 20:12:38 +0200 Subject: XCB: fix a possible array overflow leading to a crash The QClipboard::Mode returned from modeForAtom should be checked everywhere because values greater than Selection (i.e. FindBuffer) aren't supported on X and should mean error conditions. The lack of such a check did an out-of-bounds array access, which could lead to a crash. Change-Id: I70f70b5f713ab2f892e258d4df2f7afeb434f0c1 Reviewed-by: Uli Schlachter Reviewed-by: Gatis Paeglis --- src/plugins/platforms/xcb/qxcbclipboard.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp index e7f8510706..a5bbefcfd1 100644 --- a/src/plugins/platforms/xcb/qxcbclipboard.cpp +++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp @@ -738,6 +738,9 @@ void QXcbClipboard::handleSelectionRequest(xcb_selection_request_event_t *req) void QXcbClipboard::handleXFixesSelectionRequest(xcb_xfixes_selection_notify_event_t *event) { QClipboard::Mode mode = modeForAtom(event->selection); + if (mode > QClipboard::Selection) + return; + // here we care only about the xfixes events that come from non Qt processes if (event->owner != XCB_NONE && event->owner != owner()) { if (!m_xClipboard[mode]) { -- cgit v1.2.3 From d9e1a0f05b30fd646a6b473bea605f6054bf0e67 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sat, 20 Sep 2014 18:58:47 +0200 Subject: QRegion: fix a memory leak An early return in case of errors leaked memory tracked in a variable in scope. Change-Id: I68cd77890608caff54df7476d38850e5541ce76e Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Gunnar Sletta --- src/gui/painting/qregion.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index 20c62fdd9d..f1f6a51305 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -3562,8 +3562,10 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule) return region; } - if (!(pETEs = static_cast(malloc(sizeof(EdgeTableEntry) * Count)))) + if (!(pETEs = static_cast(malloc(sizeof(EdgeTableEntry) * Count)))) { + delete region; return 0; + } region->vectorize(); -- cgit v1.2.3 From 8c2f0ac3827e765dfd31711ad576b396df7df467 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sat, 20 Sep 2014 18:52:15 +0200 Subject: QObject: fix a memory leak in moveToThread For some reason it seems to be supported to call moveToThread(0). That call will allocate a new QThreadData for the object. However, if we then detect that we're calling moveToThread from a thread which is not the one the QObject has affinity with, we error out leaking that QThreadData object. Change-Id: I0fe6625a2a9887535e457f3897b514d2a03d1480 Reviewed-by: Thiago Macieira Reviewed-by: Marc Mutz --- src/corelib/kernel/qobject.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index e588808ee8..9ab952362c 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1461,14 +1461,14 @@ void QObject::moveToThread(QThread *targetThread) } QThreadData *currentData = QThreadData::current(); - QThreadData *targetData = targetThread ? QThreadData::get2(targetThread) : new QThreadData(0); + QThreadData *targetData = targetThread ? QThreadData::get2(targetThread) : Q_NULLPTR; if (d->threadData->thread == 0 && currentData == targetData) { // one exception to the rule: we allow moving objects with no thread affinity to the current thread currentData = d->threadData; } else if (d->threadData != currentData) { qWarning("QObject::moveToThread: Current thread (%p) is not the object's thread (%p).\n" "Cannot move to target thread (%p)\n", - currentData->thread, d->threadData->thread, targetData->thread); + currentData->thread, d->threadData->thread, targetData ? targetData->thread : Q_NULLPTR); #ifdef Q_OS_MAC qWarning("On Mac OS X, you might be loading two sets of Qt binaries into the same process. " @@ -1482,6 +1482,9 @@ void QObject::moveToThread(QThread *targetThread) // prepare to move d->moveToThread_helper(); + if (!targetData) + targetData = new QThreadData(0); + QOrderedMutexLocker locker(¤tData->postEventList.mutex, &targetData->postEventList.mutex); -- cgit v1.2.3 From fb8c7953026e12cf97150b5397bdfb9e32d1ca5b Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sat, 20 Sep 2014 17:38:02 +0200 Subject: QTransform: initialize the d member Although never used, the d member triggers all sorts of warnings when copying a QTransform around because it's technically undefined behavior (reading from an uninitialized variable). Change-Id: If06b6bea6f0ec0623c38ba330d46958b373cdc65 Reviewed-by: Marc Mutz Reviewed-by: Gunnar Sletta --- src/gui/painting/qtransform.cpp | 4 ++++ src/gui/painting/qtransform.h | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index 30673d90fe..c79a77cc63 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -258,6 +258,7 @@ QTransform::QTransform() , m_13(0), m_23(0), m_33(1) , m_type(TxNone) , m_dirty(TxNone) + , d(Q_NULLPTR) { } @@ -276,6 +277,7 @@ QTransform::QTransform(qreal h11, qreal h12, qreal h13, , m_13(h13), m_23(h23), m_33(h33) , m_type(TxNone) , m_dirty(TxProject) + , d(Q_NULLPTR) { } @@ -292,6 +294,7 @@ QTransform::QTransform(qreal h11, qreal h12, qreal h21, , m_13(0), m_23(0), m_33(1) , m_type(TxNone) , m_dirty(TxShear) + , d(Q_NULLPTR) { } @@ -307,6 +310,7 @@ QTransform::QTransform(const QMatrix &mtx) m_13(0), m_23(0), m_33(1) , m_type(TxNone) , m_dirty(TxShear) + , d(Q_NULLPTR) { } diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h index 060362f63e..25b0e7c2fa 100644 --- a/src/gui/painting/qtransform.h +++ b/src/gui/painting/qtransform.h @@ -162,12 +162,18 @@ private: : affine(h11, h12, h21, h22, h31, h32, true) , m_13(h13), m_23(h23), m_33(h33) , m_type(TxNone) - , m_dirty(TxProject) {} + , m_dirty(TxProject) + , d(Q_NULLPTR) + { + } inline QTransform(bool) : affine(true) , m_13(0), m_23(0), m_33(1) , m_type(TxNone) - , m_dirty(TxNone) {} + , m_dirty(TxNone) + , d(Q_NULLPTR) + { + } inline TransformationType inline_type() const; QMatrix affine; qreal m_13; -- cgit v1.2.3 From 8f622fef415cacb50f826268282a276502dcc607 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sat, 20 Sep 2014 17:47:31 +0200 Subject: Prevent a Coverity warning about a dangerous code path Coverity warns that we may access the gray array without initializing it. The array is initialized if d (the source image depth) is 8. However, when doing ordered dithering, we don't check that depth any more and just use the array. There are instead checks in place for the other dither modes; the one for ordered has been commented out before public history. So, for the love of kittens, put the check back. Change-Id: I1cc5ced8edbb626777e54e9f4e58f152c6b28ddc Reviewed-by: Gunnar Sletta Reviewed-by: Marc Mutz --- src/gui/image/qimage_conversions.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp index f2f71b4bad..66fe9ec3a8 100644 --- a/src/gui/image/qimage_conversions.cpp +++ b/src/gui/image/qimage_conversions.cpp @@ -1047,8 +1047,7 @@ void dither_to_Mono(QImageData *dst, const QImageData *src, dst_data += dst_bpl; src_data += src_bpl; } - } else - /* (d == 8) */ { + } else if (d == 8) { for (int i=0; i Date: Sat, 20 Sep 2014 16:49:24 +0200 Subject: QFile: fix undefined behavior when closing a buffered file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit C11 §7.21.3.4 [Files] says that The value of a pointer to a FILE object is indeterminate after the associated file is closed POSIX.1-2013 reinforces by saying that After the call to fclose(), any use of stream results in undefined behavior. This means we can't call fclose() again on a FILE *, even if fclose() returned EOF and set errno to EINTR. Change-Id: I282f4ff926e3c134729defa290c80d42431e97ce Reviewed-by: Marc Mutz Reviewed-by: Thiago Macieira Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qfsfileengine.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index 1ae182a4c1..e198cd6d75 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -168,10 +168,7 @@ QFSFileEngine::~QFSFileEngine() Q_D(QFSFileEngine); if (d->closeFileHandle) { if (d->fh) { - int ret; - do { - ret = fclose(d->fh); - } while (ret == EOF && errno == EINTR); + fclose(d->fh); } else if (d->fd != -1) { int ret; do { @@ -375,15 +372,14 @@ bool QFSFileEnginePrivate::closeFdFh() // Close the file if we created the handle. if (closeFileHandle) { int ret; - do { - if (fh) { - // Close buffered file. - ret = fclose(fh) != 0 ? -1 : 0; - } else { - // Close unbuffered file. - ret = QT_CLOSE(fd); - } - } while (ret == -1 && errno == EINTR); + + if (fh) { + // Close buffered file. + ret = fclose(fh); + } else { + // Close unbuffered file. + EINTR_LOOP(ret, QT_CLOSE(fd)); + } // We must reset these guys regardless; calling close again after a // failed close causes crashes on some systems. -- cgit v1.2.3 From 0d48e774c6361d91dff9bd65785b1043ef20ea25 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sun, 21 Sep 2014 15:18:17 +0200 Subject: Refactor some loops over EINTR QT_CLOSE is #defined to be qt_safe_close which already performs the EINTR loop. So there's no need of doing other loops (either by hand or by the EINTR_LOOP macro). Change-Id: Icca256124def5ab5d79c2ba101c6f889c85d19da Reviewed-by: Thiago Macieira --- src/corelib/io/qfsfileengine.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index e198cd6d75..bed77678fa 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -170,10 +170,7 @@ QFSFileEngine::~QFSFileEngine() if (d->fh) { fclose(d->fh); } else if (d->fd != -1) { - int ret; - do { - ret = QT_CLOSE(d->fd); - } while (ret == -1 && errno == EINTR); + QT_CLOSE(d->fd); } } QList keys = d->maps.keys(); @@ -378,7 +375,7 @@ bool QFSFileEnginePrivate::closeFdFh() ret = fclose(fh); } else { // Close unbuffered file. - EINTR_LOOP(ret, QT_CLOSE(fd)); + ret = QT_CLOSE(fd); } // We must reset these guys regardless; calling close again after a -- cgit v1.2.3 From 3bfdacaaebfcb3299eedd6f02977b49e732cfc30 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 8 Aug 2014 12:12:06 -0300 Subject: Document that default-constructed QFuture are canceled Task-number: QTBUG-40680 Change-Id: Idee9ff75c89c8349be779b90ee9c34a899d92c0c Reviewed-by: Marc Mutz Reviewed-by: Jerome Pasion Reviewed-by: Martin Smith --- src/corelib/thread/qfuture.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/thread/qfuture.qdoc b/src/corelib/thread/qfuture.qdoc index 951b369fad..6b3a635291 100644 --- a/src/corelib/thread/qfuture.qdoc +++ b/src/corelib/thread/qfuture.qdoc @@ -97,7 +97,7 @@ /*! \fn QFuture::QFuture() - Constructs an empty future. + Constructs an empty, canceled future. */ /*! \fn QFuture::QFuture(const QFuture &other) -- cgit v1.2.3 From e66a878838f17a0626b0b10b340b1ca4dba56cc1 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 18 Sep 2014 13:51:29 +0200 Subject: QSettings: Don't chop off trailing tabs that were actually part of a value. This was done wrong when using the ini format. Task-number: QTBUG-22461 Change-Id: Ib9390460bce6138659cceac7e3cd25339ba5e9bb Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/corelib/io/qsettings.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 1748170324..7330a565a2 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -774,11 +774,11 @@ void QSettingsPrivate::iniEscapedString(const QString &str, QByteArray &result, } } -inline static void iniChopTrailingSpaces(QString &str) +inline static void iniChopTrailingSpaces(QString &str, int limit) { int n = str.size() - 1; QChar ch; - while (n >= 0 && ((ch = str.at(n)) == QLatin1Char(' ') || ch == QLatin1Char('\t'))) + while (n >= limit && ((ch = str.at(n)) == QLatin1Char(' ') || ch == QLatin1Char('\t'))) str.truncate(n--); } @@ -836,6 +836,7 @@ StSkipSpaces: // fallthrough StNormal: + int chopLimit = stringResult.length(); while (i < to) { switch (str.at(i)) { case '\\': @@ -873,6 +874,7 @@ StNormal: } else { // the character is skipped } + chopLimit = stringResult.length(); break; case '"': ++i; @@ -884,7 +886,7 @@ StNormal: case ',': if (!inQuotedString) { if (!currentValueIsQuoted) - iniChopTrailingSpaces(stringResult); + iniChopTrailingSpaces(stringResult, chopLimit); if (!isStringList) { isStringList = true; stringListResult.clear(); @@ -924,6 +926,8 @@ StNormal: } } } + if (!currentValueIsQuoted) + iniChopTrailingSpaces(stringResult, chopLimit); goto end; StHexEscape: @@ -963,8 +967,6 @@ StOctEscape: } end: - if (!currentValueIsQuoted) - iniChopTrailingSpaces(stringResult); if (isStringList) stringListResult.append(stringResult); return isStringList; -- cgit v1.2.3 From abde2a59c603899c80e67bb5e7f892d554ff72fd Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 22 Sep 2014 14:55:04 +0200 Subject: Cocoa: Properly remove content view from its superview in setNSWindow() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -[NSWindow setContentView:] doesn't make assupmtions about where that view comes from, and just attaches it to the window. We need to make sure we detach it from its previous window by calling -[NSView removeFromSuperview], or the previous NSWindow may keep references to the view. This can be an issue if the view is deleted right after. Task-number: QTBUG-39628 Change-Id: I152dedcb64ac044d8ca290c9996b388809e2477b Reviewed-by: Timur Pocheptsov Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoawindow.mm | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 19d0f7a987..96c882887e 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1477,7 +1477,11 @@ void QCocoaWindow::setNSWindow(QCocoaNSWindow *window) { if (window.contentView != m_contentView) { [m_contentView setPostsFrameChangedNotifications: NO]; + [m_contentView retain]; + if (m_contentView.superview) // m_contentView comes from another NSWindow + [m_contentView removeFromSuperview]; [window setContentView:m_contentView]; + [m_contentView release]; [m_contentView setPostsFrameChangedNotifications: YES]; } } -- cgit v1.2.3 From 3b3ecb79a6b61a085445b42253cc90c8e58e1c6c Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 22 Sep 2014 22:58:49 +0200 Subject: Fix compilation on OS X with macx-clang-32 Task-number: QTBUG-27335 Change-Id: I1703aee2d90e02b1a6ed386715bebddf6dedb9f5 Reviewed-by: Jake Petroules --- src/widgets/styles/qmacstyle_mac.mm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index d74e032412..c7b9186e34 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -1816,8 +1816,8 @@ void QMacStylePrivate::drawNSViewInRect(NSView *view, const QRect &qtRect, QPain CGRect rect = CGRectMake(qtRect.x() + 1, qtRect.y(), qtRect.width(), qtRect.height()); [backingStoreNSView addSubview:view]; - view.frame = rect; - [view drawRect:rect]; + view.frame = NSRectFromCGRect(rect); + [view drawRect:NSRectFromCGRect(rect)]; [view removeFromSuperviewWithoutNeedingDisplay]; [NSGraphicsContext restoreGraphicsState]; @@ -3808,9 +3808,9 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter NSBezierPath *pushButtonFocusRingPath; if (bdi.kind == kThemeBevelButton) - pushButtonFocusRingPath = [NSBezierPath bezierPathWithRect:focusRect]; + pushButtonFocusRingPath = [NSBezierPath bezierPathWithRect:NSRectFromCGRect(focusRect)]; else - pushButtonFocusRingPath = [NSBezierPath bezierPathWithRoundedRect:focusRect xRadius:4 yRadius:4]; + pushButtonFocusRingPath = [NSBezierPath bezierPathWithRoundedRect:NSRectFromCGRect(focusRect) xRadius:4 yRadius:4]; qt_drawFocusRingOnPath(cg, pushButtonFocusRingPath); } -- cgit v1.2.3 From b5ae9d8efec8e71ca52db7a142195c2ee37e68f9 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 22 Sep 2014 16:50:19 +0200 Subject: QMacStyle: Improvements to some buttons on Yosemite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Radio button, checkbox and non-editable combobox, in normal, small and mini sizes, and only in the inactive state. This commit amends 982b9b7ec2441103b100. Task-number: QTBUG-40833 Change-Id: If3f2bb215e9b8966cbf15f08fa252feb92483c7b Reviewed-by: Morten Johan Sørvig --- src/widgets/styles/qmacstyle_mac.mm | 78 ++++++++++++++++++++++++++-------- src/widgets/styles/qmacstyle_mac_p_p.h | 2 +- 2 files changed, 62 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index c7b9186e34..60e18eae5a 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -1738,11 +1738,13 @@ ThemeDrawState QMacStylePrivate::getDrawState(QStyle::State flags) return tds; } -NSView *QMacStylePrivate::buttonOfKind(ThemeButtonKind kind) const +NSView *QMacStylePrivate::buttonOfKind(ThemeButtonKind kind, QPoint *offset) const { NSView *bv = buttons[kind]; if (!bv) { - if (kind == kThemePopupButton) + if (kind == kThemePopupButton + || kind == kThemePopupButtonSmall + || kind == kThemePopupButtonMini) bv = [[NSPopUpButton alloc] init]; else if (kind == kThemeComboBox) bv = [[NSComboBox alloc] init]; @@ -1782,25 +1784,61 @@ NSView *QMacStylePrivate::buttonOfKind(ThemeButtonKind kind) const break; } -// if (kind == kThemePushButtonSmall -// || kind == kThemePopupButtonSmall -// || kind == kThemeCheckBoxSmall -// || kind == kThemeRadioButtonSmall) -// bc.controlSize = NSSmallControlSize; -// else if (kind == kThemePushButtonMini -// || kind == kThemePopupButtonMini -// || kind == kThemeCheckBoxMini -// || kind == kThemeRadioButtonMini) -// bc.controlSize = NSMiniControlSize; - if ([bv isKindOfClass:[NSButton class]]) { NSButton *bc = (NSButton *)bv; bc.title = nil; + + NSCell *bcell = bc.cell; + switch (kind) { + case kThemePushButtonSmall: + case kThemePopupButtonSmall: + case kThemeCheckBoxSmall: + case kThemeRadioButtonSmall: + bcell.controlSize = NSSmallControlSize; + break; + case kThemePushButtonMini: + case kThemePopupButtonMini: + case kThemeCheckBoxMini: + case kThemeRadioButtonMini: + bcell.controlSize = NSMiniControlSize; + break; + default: + break; + } } const_cast(this)->buttons.insert(kind, bv); } + if (offset) { + switch (kind) { + case kThemeRadioButton: + offset->setY(2); + break; + case kThemeRadioButtonSmall: + *offset = QPoint(-1, 2); + break; + case kThemeRadioButtonMini: + offset->setY(2); + break; + case kThemePopupButtonSmall: + case kThemeCheckBox: + offset->setY(1); + break; + case kThemeCheckBoxSmall: + offset->setX(-1); + break; + case kThemeCheckBoxMini: + *offset = QPoint(7, 5); + break; + case kThemePopupButtonMini: + *offset = QPoint(2, -1); + break; + default: + break; + } + } + return bv; } @@ -1917,14 +1955,20 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD } pm = QPixmap::fromImage(image); } else if ((usingYosemiteOrLater && combo && !editableCombo) || button) { - NSButton *bc = (NSButton *)buttonOfKind(bdi->kind); + QPoint offset; + NSButton *bc = (NSButton *)buttonOfKind(bdi->kind, &offset); [bc highlight:pressed]; bc.enabled = bdi->state != kThemeStateUnavailable && bdi->state != kThemeStateUnavailableInactive; + bc.allowsMixedState = YES; bc.state = bdi->value == kThemeButtonOn ? NSOnState : bdi->value == kThemeButtonMixed ? NSMixedState : NSOffState; - p->translate(0, 1); - drawNSViewInRect(bc, opt->rect, p); - p->translate(0, -1); + // The view frame may differ from what we pass to HITheme + QRect rect = opt->rect; + if (bdi->kind == kThemePopupButtonMini) + rect.adjust(0, 0, -5, 0); + p->translate(offset); + drawNSViewInRect(bc, rect, p); + p->translate(-offset); return; } else if (usingYosemiteOrLater && editableCombo) { QImage image = activePixmap.toImage(); diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/widgets/styles/qmacstyle_mac_p_p.h index 3bbff61340..e4aad113d0 100644 --- a/src/widgets/styles/qmacstyle_mac_p_p.h +++ b/src/widgets/styles/qmacstyle_mac_p_p.h @@ -195,7 +195,7 @@ public: void setAutoDefaultButton(QObject *button) const; - NSView *buttonOfKind(ThemeButtonKind kind) const; + NSView *buttonOfKind(ThemeButtonKind kind, QPoint *offset) const; void drawNSViewInRect(NSView *view, const QRect &rect, QPainter *p) const; void resolveCurrentNSView(QWindow *window); -- cgit v1.2.3 From 5c2d7b1635904da257938af740af024928b8ce5e Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sat, 20 Sep 2014 18:07:32 +0200 Subject: XCB: fix a memory leak An early return didn't deallocate a xkb_state struct. Change-Id: I158ffc67030403636aceab985cc605888a31804b Reviewed-by: Uli Schlachter Reviewed-by: Marc Mutz Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbkeyboard.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index af75b650d1..a873ba97d7 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -852,8 +852,10 @@ QList QXcbKeyboard::possibleKeys(const QKeyEvent *event) const baseLayout, latchedLayout, lockedLayout); xkb_keysym_t sym = xkb_state_key_get_one_sym(kb_state, event->nativeScanCode()); - if (sym == XKB_KEY_NoSymbol) + if (sym == XKB_KEY_NoSymbol) { + xkb_state_unref(kb_state); return QList(); + } QList result; int baseQtKey = keysymToQtKey(sym, modifiers, lookupString(kb_state, event->nativeScanCode())); -- cgit v1.2.3 From 097b641c3eb588f1707f87e6a9bedb1d3d8cc31d Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Fri, 19 Sep 2014 17:18:59 +0200 Subject: QNAM: Fix previous HTTP upload CPU fix My previous fix for CPU load issues between HTTP thread and user thread was fragile if the upload QIODevice emitted readyRead() multiple times. [ChangeLog][QtNetwork][QNetworkAccessManager] Fix behavior of upload QIODevice that generate data on readyRead() for HTTP PUT/POST Change-Id: Idb1c2d5a382a704d8cc08fe03c55c883bfc95aa7 Reviewed-by: Christian Kamm Reviewed-by: Richard J. Moore --- src/network/access/qnetworkreplyhttpimpl.cpp | 11 ++++++++++- src/network/access/qnetworkreplyhttpimpl_p.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index 4efb2f6a2a..511faca11d 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -428,6 +428,7 @@ QNetworkReplyHttpImplPrivate::QNetworkReplyHttpImplPrivate() , synchronous(false) , state(Idle) , statusCode(0) + , uploadDeviceChoking(false) , outgoingData(0) , bytesUploaded(-1) , cacheLoadDevice(0) @@ -1291,9 +1292,12 @@ void QNetworkReplyHttpImplPrivate::wantUploadDataSlot(qint64 maxSize) char *data = const_cast(uploadByteDevice->readPointer(maxSize, currentUploadDataLength)); if (currentUploadDataLength == 0) { + uploadDeviceChoking = true; // No bytes from upload byte device. There will be bytes later, it will emit readyRead() // and our uploadByteDeviceReadyReadSlot() is called. return; + } else { + uploadDeviceChoking = false; } // Let's make a copy of this data @@ -1306,7 +1310,12 @@ void QNetworkReplyHttpImplPrivate::wantUploadDataSlot(qint64 maxSize) void QNetworkReplyHttpImplPrivate::uploadByteDeviceReadyReadSlot() { // Start the flow between this thread and the HTTP thread again by triggering a upload. - wantUploadDataSlot(1024); + // However only do this when we were choking before, else the state in + // QNonContiguousByteDeviceThreadForwardImpl gets messed up. + if (uploadDeviceChoking) { + uploadDeviceChoking = false; + wantUploadDataSlot(1024); + } } diff --git a/src/network/access/qnetworkreplyhttpimpl_p.h b/src/network/access/qnetworkreplyhttpimpl_p.h index 06a5383ae4..4a5b61a227 100644 --- a/src/network/access/qnetworkreplyhttpimpl_p.h +++ b/src/network/access/qnetworkreplyhttpimpl_p.h @@ -212,6 +212,7 @@ public: // upload QNonContiguousByteDevice* createUploadByteDevice(); QSharedPointer uploadByteDevice; + bool uploadDeviceChoking; // if we couldn't readPointer() any data at the moment QIODevice *outgoingData; QSharedPointer outgoingDataBuffer; void emitReplyUploadProgress(qint64 bytesSent, qint64 bytesTotal); // dup? -- cgit v1.2.3 From 5222abfdf5f034bad12bbe12312a4149550495b7 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sat, 20 Sep 2014 17:57:30 +0200 Subject: Uic: fix a leak There are a couple of code paths in which we return from a function without freeing the memory pointed by a local pointer. For the sake of not over-modifying the code, I chose not to turn "ui" into a scoped pointer. Change-Id: I0b23944f7526d250c1ebeca0bae9bdc36dceceed Reviewed-by: Oswald Buddenhagen Reviewed-by: hjk --- src/tools/uic/uic.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/tools/uic/uic.cpp b/src/tools/uic/uic.cpp index be4df64696..265f578524 100644 --- a/src/tools/uic/uic.cpp +++ b/src/tools/uic/uic.cpp @@ -219,6 +219,7 @@ bool Uic::write(QIODevice *in) #ifdef QT_UIC_JAVA_GENERATOR if (language.toLower() != QLatin1String("jambi")) { fprintf(stderr, "uic: File is not a 'jambi' form\n"); + delete ui; return false; } rtn = jwrite (ui); @@ -229,6 +230,7 @@ bool Uic::write(QIODevice *in) #ifdef QT_UIC_CPP_GENERATOR if (!language.isEmpty() && language.toLower() != QLatin1String("c++")) { fprintf(stderr, "uic: File is not a 'c++' ui file, language=%s\n", qPrintable(language)); + delete ui; return false; } -- cgit v1.2.3