From 13f5e5c6b2c320c33dd0b9305de410bef1b3c2c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=82osz=20Kosobucki?= Date: Sat, 11 Nov 2017 21:05:39 +0100 Subject: [PATCH 01/10] Improve QObject::moveToThread doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change mentions of parameter value being "zero" to nullptr. Clarify that when nullptr is passed to moveToThread() event processing is stopped because the object is no longer associated with any thread. Also, reitarete this fact in the paragraph about processing of new events. There's an exception to the rule that QObjects cannot be "pulled" by moveToThread that is buried in the implementation and not mentioned in the doc. This information is worth noting explicitly. Change-Id: I816ff737c48d8057b39e36b566079710aeb8e690 Reviewed-by: André Hartmann Reviewed-by: Edward Welbourne --- src/corelib/kernel/qobject.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index a791d2e8b3b..2a05f7f3839 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1445,8 +1445,9 @@ QThread *QObject::thread() const \snippet code/src_corelib_kernel_qobject.cpp 7 - If \a targetThread is zero, all event processing for this object - and its children stops. + If \a targetThread is \nullptr, all event processing for this object + and its children stops, as they are no longer associated with any + thread. Note that all active timers for the object will be reset. The timers are first stopped in the current thread and restarted (with @@ -1457,13 +1458,18 @@ QThread *QObject::thread() const A QEvent::ThreadChange event is sent to this object just before the thread affinity is changed. You can handle this event to perform any special processing. Note that any new events that are - posted to this object will be handled in the \a targetThread. + posted to this object will be handled in the \a targetThread, + provided it is non-null: when it is \nullptr, no event processing + for this object or its children can happen, as they are no longer + associated with any thread. \warning This function is \e not thread-safe; the current thread must be same as the current thread affinity. In other words, this function can only "push" an object from the current thread to another thread, it cannot "pull" an object from any arbitrary - thread to the current thread. + thread to the current thread. There is one exception to this rule + however: objects with no thread affinity can be "pulled" to the + current thread. \sa thread() */ From 2e8005765d6513c4743a939aea97c68427f6ab2c Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Wed, 24 Apr 2019 09:00:07 +0200 Subject: [PATCH 02/10] Update bundled libpng to version 1.6.37 The remaining diff to clean 1.6.37 is archived in the qtpatches.diff file. [ChangeLog][Third-Party Code] libpng was updated to version 1.6.37 Change-Id: I589bff09beec1977be8c6ca2a60aadf05f337f38 Reviewed-by: Liang Qi --- src/3rdparty/libpng/ANNOUNCE | 66 +++++++------------------ src/3rdparty/libpng/CHANGES | 39 ++++++++++----- src/3rdparty/libpng/LICENSE | 8 +-- src/3rdparty/libpng/README | 4 +- src/3rdparty/libpng/libpng-manual.txt | 8 +-- src/3rdparty/libpng/png.c | 11 ++--- src/3rdparty/libpng/png.h | 34 ++++++------- src/3rdparty/libpng/pngconf.h | 6 +-- src/3rdparty/libpng/pnglibconf.h | 4 +- src/3rdparty/libpng/pngpriv.h | 10 ++-- src/3rdparty/libpng/pngread.c | 8 ++- src/3rdparty/libpng/pngrtran.c | 48 +++++++++--------- src/3rdparty/libpng/pngstruct.h | 12 +++-- src/3rdparty/libpng/pngwrite.c | 6 +-- src/3rdparty/libpng/qt_attribution.json | 4 +- src/3rdparty/libpng/qtpatches.diff | 8 +-- 16 files changed, 132 insertions(+), 144 deletions(-) diff --git a/src/3rdparty/libpng/ANNOUNCE b/src/3rdparty/libpng/ANNOUNCE index f1724c0d0d9..ecf9c7043b0 100644 --- a/src/3rdparty/libpng/ANNOUNCE +++ b/src/3rdparty/libpng/ANNOUNCE @@ -1,5 +1,5 @@ -libpng 1.6.36 - December 1, 2018 -================================ +libpng 1.6.37 - April 14, 2019 +============================== This is a public release of libpng, intended for use in production code. @@ -9,13 +9,13 @@ Files available for download Source files with LF line endings (for Unix/Linux): - * libpng-1.6.36.tar.xz (LZMA-compressed, recommended) - * libpng-1.6.36.tar.gz + * libpng-1.6.37.tar.xz (LZMA-compressed, recommended) + * libpng-1.6.37.tar.gz Source files with CRLF line endings (for Windows): - * lp1636.7z (LZMA-compressed, recommended) - * lp1636.zip + * lp1637.7z (LZMA-compressed, recommended) + * lp1637.zip Other information: @@ -25,50 +25,20 @@ Other information: * TRADEMARK.md -IMPORTANT licensing update: libpng license v2 ---------------------------------------------- - -The new libpng license comprises the terms and conditions from the zlib -license, and the disclaimer from the Boost license. - -The legacy libpng license, used until libpng-1.6.35, is appended to the -new license, following the precedent established in the Python Software -Foundation License version 2. - -From now on, the list of contributing authors shall be maintained in a -separate AUTHORS file. The lists of previous contributing authors, -mentioned in the legacy libpng license and considered to be an integral -part of that license, are kept intact, with no further updates. - - -Changes since the previous public release (version 1.6.35) +Changes since the previous public release (version 1.6.36) ---------------------------------------------------------- - * Optimized png_do_expand_palette for ARM processors. - Improved performance by around 10-22% on a recent ARM Chromebook. - (Contributed by Richard Townsend, ARM Holdings) - * Fixed manipulation of machine-specific optimization options. - (Contributed by Vicki Pfau) - * Used memcpy instead of manual pointer arithmetic on Intel SSE2. - (Contributed by Samuel Williams) - * Fixed build errors with MSVC on ARM64. - (Contributed by Zhijie Liang) - * Fixed detection of libm in CMakeLists. - (Contributed by Cameron Cawley) - * Fixed incorrect creation of pkg-config file in CMakeLists. - (Contributed by Kyle Bentley) - * Fixed the CMake build on Windows MSYS by avoiding symlinks. - * Fixed a build warning on OpenBSD. - (Contributed by Theo Buehler) - * Fixed various typos in comments. - (Contributed by "luz.paz") - * Raised the minimum required CMake version from 3.0.2 to 3.1. - * Removed yet more of the vestigial support for pre-ANSI C compilers. - * Removed ancient makefiles for ancient systems that have been broken - across all previous libpng-1.6.x versions. - * Removed the Y2K compliance statement and the export control - information. - * Applied various code style and documentation fixes. + * Fixed a use-after-free vulnerability (CVE-2019-7317) in png_image_free. + * Fixed a memory leak in the ARM NEON implementation of png_do_expand_palette. + * Fixed a memory leak in pngtest.c. + * Fixed two vulnerabilities (CVE-2018-14048, CVE-2018-14550) in + contrib/pngminus; refactor. + * Changed the license of contrib/pngminus to MIT; refresh makefile and docs. + (Contributed by Willem van Schaik) + * Fixed a typo in the libpng license v2. + (Contributed by Miguel Ojeda) + * Added makefiles for AddressSanitizer-enabled builds. + * Cleaned up various makefiles. Send comments/corrections/commendations to png-mng-implement at lists.sf.net. diff --git a/src/3rdparty/libpng/CHANGES b/src/3rdparty/libpng/CHANGES index bdd44806549..f0b0a9342c3 100644 --- a/src/3rdparty/libpng/CHANGES +++ b/src/3rdparty/libpng/CHANGES @@ -6066,31 +6066,44 @@ Version 1.6.35 [July 15, 2018] Version 1.6.36 [December 1, 2018] Optimized png_do_expand_palette for ARM processors. Improved performance by around 10-22% on a recent ARM Chromebook. - (Contributed by Richard Townsend, ARM Holdings) + (Contributed by Richard Townsend, ARM Holdings) Fixed manipulation of machine-specific optimization options. - (Contributed by Vicki Pfau) + (Contributed by Vicki Pfau) Used memcpy instead of manual pointer arithmetic on Intel SSE2. - (Contributed by Samuel Williams) + (Contributed by Samuel Williams) Fixed build errors with MSVC on ARM64. - (Contributed by Zhijie Liang) + (Contributed by Zhijie Liang) Fixed detection of libm in CMakeLists. - (Contributed by Cameron Cawley) + (Contributed by Cameron Cawley) Fixed incorrect creation of pkg-config file in CMakeLists. - (Contributed by Kyle Bentley) + (Contributed by Kyle Bentley) Fixed the CMake build on Windows MSYS by avoiding symlinks. Fixed a build warning on OpenBSD. - (Contributed by Theo Buehler) + (Contributed by Theo Buehler) Fixed various typos in comments. - (Contributed by "luz.paz") + (Contributed by "luz.paz") Raised the minimum required CMake version from 3.0.2 to 3.1. Removed yet more of the vestigial support for pre-ANSI C compilers. Removed ancient makefiles for ancient systems that have been broken - across all previous libpng-1.6.x versions. + across all previous libpng-1.6.x versions. Removed the Y2K compliance statement and the export control - information. + information. Applied various code style and documentation fixes. -Send comments/corrections/commendations to png-mng-implement at lists.sf.net -(subscription required; visit +Version 1.6.37 [April 14, 2019] + Fixed a use-after-free vulnerability (CVE-2019-7317) in png_image_free. + Fixed a memory leak in the ARM NEON implementation of png_do_expand_palette. + Fixed a memory leak in pngtest.c. + Fixed two vulnerabilities (CVE-2018-14048, CVE-2018-14550) in + contrib/pngminus; refactor. + Changed the license of contrib/pngminus to MIT; refresh makefile and docs. + (Contributed by Willem van Schaik) + Fixed a typo in the libpng license v2. + (Contributed by Miguel Ojeda) + Added makefiles for AddressSanitizer-enabled builds. + Cleaned up various makefiles. + +Send comments/corrections/commendations to png-mng-implement at lists.sf.net. +Subscription is required; visit https://lists.sourceforge.net/lists/listinfo/png-mng-implement -to subscribe). +to subscribe. diff --git a/src/3rdparty/libpng/LICENSE b/src/3rdparty/libpng/LICENSE index 62ab8e48dcf..e0c5b531cf5 100644 --- a/src/3rdparty/libpng/LICENSE +++ b/src/3rdparty/libpng/LICENSE @@ -4,8 +4,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE PNG Reference Library License version 2 --------------------------------------- - * Copyright (c) 1995-2018 The PNG Reference Library Authors. - * Copyright (c) 2018 Cosmin Truta. + * Copyright (c) 1995-2019 The PNG Reference Library Authors. + * Copyright (c) 2018-2019 Cosmin Truta. * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson. * Copyright (c) 1996-1997 Andreas Dilger. * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -13,7 +13,7 @@ PNG Reference Library License version 2 The software is supplied "as is", without warranty of any kind, express or implied, including, without limitation, the warranties of merchantability, fitness for a particular purpose, title, and -non-infringement. In no even shall the Copyright owners, or +non-infringement. In no event shall the Copyright owners, or anyone distributing the software, be liable for any damages or other liability, whether in contract, tort or otherwise, arising from, out of, or in connection with the software, or the use or @@ -39,7 +39,7 @@ subject to the following restrictions: PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35) ----------------------------------------------------------------------- -libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are +libpng versions 1.0.7, July 1, 2000, through 1.6.35, July 15, 2018 are Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are derived from libpng-1.0.6, and are distributed according to the same disclaimer and license as libpng-1.0.6 with the following individuals diff --git a/src/3rdparty/libpng/README b/src/3rdparty/libpng/README index e41e0f549bb..cfc1f0e3dc9 100644 --- a/src/3rdparty/libpng/README +++ b/src/3rdparty/libpng/README @@ -1,5 +1,5 @@ -README for libpng version 1.6.36 - December 1, 2018 -=================================================== +README for libpng version 1.6.37 - April 14, 2019 +================================================= See the note about version numbers near the top of png.h. See INSTALL for instructions on how to install libpng. diff --git a/src/3rdparty/libpng/libpng-manual.txt b/src/3rdparty/libpng/libpng-manual.txt index 19cfed28add..5dad92fbf74 100644 --- a/src/3rdparty/libpng/libpng-manual.txt +++ b/src/3rdparty/libpng/libpng-manual.txt @@ -1,6 +1,6 @@ libpng-manual.txt - A description on how to use and modify libpng - Copyright (c) 2018 Cosmin Truta + Copyright (c) 2018-2019 Cosmin Truta Copyright (c) 1998-2018 Glenn Randers-Pehrson This document is released under the libpng license. @@ -9,11 +9,11 @@ libpng-manual.txt - A description on how to use and modify libpng Based on: - libpng version 1.6.36 - December 1, 2018 + libpng version 1.6.36, December 2018, through 1.6.37 - April 2019 Updated and distributed by Cosmin Truta - Copyright (c) 2018 Cosmin Truta + Copyright (c) 2018-2019 Cosmin Truta - libpng versions 0.97, January 1998, through 1.6.35 - July 15, 2018 + libpng versions 0.97, January 1998, through 1.6.35 - July 2018 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2018 Glenn Randers-Pehrson diff --git a/src/3rdparty/libpng/png.c b/src/3rdparty/libpng/png.c index 3dce191d17e..757c755f97c 100644 --- a/src/3rdparty/libpng/png.c +++ b/src/3rdparty/libpng/png.c @@ -1,7 +1,7 @@ /* png.c - location for general purpose libpng functions * - * Copyright (c) 2018 Cosmin Truta + * Copyright (c) 2018-2019 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -14,7 +14,7 @@ #include "pngpriv.h" /* Generate a compiler error if there is an old png.h in the search path. */ -typedef png_libpng_version_1_6_36 Your_png_h_is_not_version_1_6_36; +typedef png_libpng_version_1_6_37 Your_png_h_is_not_version_1_6_37; #ifdef __GNUC__ /* The version tests may need to be added to, but the problem warning has @@ -815,8 +815,8 @@ png_get_copyright(png_const_structrp png_ptr) return PNG_STRING_COPYRIGHT #else return PNG_STRING_NEWLINE \ - "libpng version 1.6.36" PNG_STRING_NEWLINE \ - "Copyright (c) 2018 Cosmin Truta" PNG_STRING_NEWLINE \ + "libpng version 1.6.37" PNG_STRING_NEWLINE \ + "Copyright (c) 2018-2019 Cosmin Truta" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \ PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ @@ -4588,8 +4588,7 @@ png_image_free(png_imagep image) if (image != NULL && image->opaque != NULL && image->opaque->error_buf == NULL) { - /* Ignore errors here: */ - (void)png_safe_execute(image, png_image_free_function, image); + png_image_free_function(image); image->opaque = NULL; } } diff --git a/src/3rdparty/libpng/png.h b/src/3rdparty/libpng/png.h index 8e272a05532..139eb0dc0f3 100644 --- a/src/3rdparty/libpng/png.h +++ b/src/3rdparty/libpng/png.h @@ -1,9 +1,9 @@ /* png.h - header file for PNG reference library * - * libpng version 1.6.36 - December 1, 2018 + * libpng version 1.6.37 - April 14, 2019 * - * Copyright (c) 2018 Cosmin Truta + * Copyright (c) 2018-2019 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -14,8 +14,9 @@ * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger * libpng versions 0.97, January 1998, through 1.6.35, July 2018: - * Glenn Randers-Pehrson. - * libpng version 1.6.36, December 1, 2018: Cosmin Truta + * Glenn Randers-Pehrson + * libpng versions 1.6.36, December 2018, through 1.6.37, April 2019: + * Cosmin Truta * See also "Contributing Authors", below. */ @@ -26,8 +27,8 @@ * PNG Reference Library License version 2 * --------------------------------------- * - * * Copyright (c) 1995-2018 The PNG Reference Library Authors. - * * Copyright (c) 2018 Cosmin Truta. + * * Copyright (c) 1995-2019 The PNG Reference Library Authors. + * * Copyright (c) 2018-2019 Cosmin Truta. * * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson. * * Copyright (c) 1996-1997 Andreas Dilger. * * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -35,7 +36,7 @@ * The software is supplied "as is", without warranty of any kind, * express or implied, including, without limitation, the warranties * of merchantability, fitness for a particular purpose, title, and - * non-infringement. In no even shall the Copyright owners, or + * non-infringement. In no event shall the Copyright owners, or * anyone distributing the software, be liable for any damages or * other liability, whether in contract, tort or otherwise, arising * from, out of, or in connection with the software, or the use or @@ -61,7 +62,7 @@ * PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35) * ----------------------------------------------------------------------- * - * libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are + * libpng versions 1.0.7, July 1, 2000, through 1.6.35, July 15, 2018 are * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are * derived from libpng-1.0.6, and are distributed according to the same * disclaimer and license as libpng-1.0.6 with the following individuals @@ -238,7 +239,7 @@ * ... * 1.5.30 15 10530 15.so.15.30[.0] * ... - * 1.6.36 16 10636 16.so.16.36[.0] + * 1.6.37 16 10637 16.so.16.37[.0] * * Henceforth the source version will match the shared-library major and * minor numbers; the shared-library major version number will be used for @@ -277,8 +278,8 @@ */ /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.6.36" -#define PNG_HEADER_VERSION_STRING " libpng version 1.6.36 - December 1, 2018\n" +#define PNG_LIBPNG_VER_STRING "1.6.37" +#define PNG_HEADER_VERSION_STRING " libpng version 1.6.37 - April 14, 2019\n" #define PNG_LIBPNG_VER_SONUM 16 #define PNG_LIBPNG_VER_DLLNUM 16 @@ -286,12 +287,11 @@ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ #define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MINOR 6 -#define PNG_LIBPNG_VER_RELEASE 36 +#define PNG_LIBPNG_VER_RELEASE 37 -/* This should match the numeric part of the final component of - * PNG_LIBPNG_VER_STRING, omitting any leading zero: +/* This should be zero for a public release, or non-zero for a + * development version. [Deprecated] */ - #define PNG_LIBPNG_VER_BUILD 0 /* Release Status */ @@ -318,7 +318,7 @@ * From version 1.0.1 it is: * XXYYZZ, where XX=major, YY=minor, ZZ=release */ -#define PNG_LIBPNG_VER 10636 /* 1.6.36 */ +#define PNG_LIBPNG_VER 10637 /* 1.6.37 */ /* Library configuration: these options cannot be changed after * the library has been built. @@ -428,7 +428,7 @@ extern "C" { /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ -typedef char* png_libpng_version_1_6_36; +typedef char* png_libpng_version_1_6_37; /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. * diff --git a/src/3rdparty/libpng/pngconf.h b/src/3rdparty/libpng/pngconf.h index 5e641b25098..927a769dbee 100644 --- a/src/3rdparty/libpng/pngconf.h +++ b/src/3rdparty/libpng/pngconf.h @@ -1,9 +1,9 @@ -/* pngconf.h - machine configurable file for libpng +/* pngconf.h - machine-configurable file for libpng * - * libpng version 1.6.36 + * libpng version 1.6.37 * - * Copyright (c) 2018 Cosmin Truta + * Copyright (c) 2018-2019 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. diff --git a/src/3rdparty/libpng/pnglibconf.h b/src/3rdparty/libpng/pnglibconf.h index 00340c678be..e1e27e957ea 100644 --- a/src/3rdparty/libpng/pnglibconf.h +++ b/src/3rdparty/libpng/pnglibconf.h @@ -1,8 +1,8 @@ /* pnglibconf.h - library build configuration */ -/* libpng version 1.6.36 */ +/* libpng version 1.6.37 */ -/* Copyright (c) 2018 Cosmin Truta */ +/* Copyright (c) 2018-2019 Cosmin Truta */ /* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */ /* This code is released under the libpng license. */ diff --git a/src/3rdparty/libpng/pngpriv.h b/src/3rdparty/libpng/pngpriv.h index f53c81d0392..2ab9b70d736 100644 --- a/src/3rdparty/libpng/pngpriv.h +++ b/src/3rdparty/libpng/pngpriv.h @@ -1,7 +1,7 @@ /* pngpriv.h - private declarations for use inside libpng * - * Copyright (c) 2018 Cosmin Truta + * Copyright (c) 2018-2019 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -2133,11 +2133,11 @@ PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr, #if PNG_ARM_NEON_IMPLEMENTATION == 1 PNG_INTERNAL_FUNCTION(void, - png_riffle_palette_rgba, - (png_structrp, png_row_infop), + png_riffle_palette_neon, + (png_structrp), PNG_EMPTY); PNG_INTERNAL_FUNCTION(int, - png_do_expand_palette_neon_rgba, + png_do_expand_palette_rgba8_neon, (png_structrp, png_row_infop, png_const_bytep, @@ -2145,7 +2145,7 @@ PNG_INTERNAL_FUNCTION(int, const png_bytepp), PNG_EMPTY); PNG_INTERNAL_FUNCTION(int, - png_do_expand_palette_neon_rgb, + png_do_expand_palette_rgb8_neon, (png_structrp, png_row_infop, png_const_bytep, diff --git a/src/3rdparty/libpng/pngread.c b/src/3rdparty/libpng/pngread.c index f8e762196eb..8fa7d9f1628 100644 --- a/src/3rdparty/libpng/pngread.c +++ b/src/3rdparty/libpng/pngread.c @@ -1,7 +1,7 @@ /* pngread.c - read a PNG file * - * Copyright (c) 2018 Cosmin Truta + * Copyright (c) 2018-2019 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -994,6 +994,12 @@ png_read_destroy(png_structrp png_ptr) png_ptr->chunk_list = NULL; #endif +#if defined(PNG_READ_EXPAND_SUPPORTED) && \ + defined(PNG_ARM_NEON_IMPLEMENTATION) + png_free(png_ptr, png_ptr->riffled_palette); + png_ptr->riffled_palette = NULL; +#endif + /* NOTE: the 'setjmp' buffer may still be allocated and the memory and error * callbacks are still set at this point. They are required to complete the * destruction of the png_struct itself. diff --git a/src/3rdparty/libpng/pngrtran.c b/src/3rdparty/libpng/pngrtran.c index ccc58ce6f1d..9a8fad9f4aa 100644 --- a/src/3rdparty/libpng/pngrtran.c +++ b/src/3rdparty/libpng/pngrtran.c @@ -1,7 +1,7 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Copyright (c) 2018 Cosmin Truta + * Copyright (c) 2018-2019 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -1182,20 +1182,20 @@ png_init_palette_transformations(png_structrp png_ptr) png_ptr->palette[png_ptr->background.index].blue; #ifdef PNG_READ_INVERT_ALPHA_SUPPORTED - if ((png_ptr->transformations & PNG_INVERT_ALPHA) != 0) - { - if ((png_ptr->transformations & PNG_EXPAND_tRNS) == 0) - { - /* Invert the alpha channel (in tRNS) unless the pixels are - * going to be expanded, in which case leave it for later - */ - int i, istop = png_ptr->num_trans; + if ((png_ptr->transformations & PNG_INVERT_ALPHA) != 0) + { + if ((png_ptr->transformations & PNG_EXPAND_tRNS) == 0) + { + /* Invert the alpha channel (in tRNS) unless the pixels are + * going to be expanded, in which case leave it for later + */ + int i, istop = png_ptr->num_trans; - for (i=0; itrans_alpha[i] = (png_byte)(255 - - png_ptr->trans_alpha[i]); - } - } + for (i = 0; i < istop; i++) + png_ptr->trans_alpha[i] = + (png_byte)(255 - png_ptr->trans_alpha[i]); + } + } #endif /* READ_INVERT_ALPHA */ } } /* background expand and (therefore) no alpha association. */ @@ -4320,9 +4320,11 @@ png_do_expand_palette(png_structrp png_ptr, png_row_infop row_info, * but sometimes row_info->bit_depth has been changed to 8. * In these cases, the palette hasn't been riffled. */ - i = png_do_expand_palette_neon_rgba(png_ptr, row_info, row, + i = png_do_expand_palette_rgba8_neon(png_ptr, row_info, row, &sp, &dp); } +#else + PNG_UNUSED(png_ptr) #endif for (; i < row_width; i++) @@ -4349,8 +4351,10 @@ png_do_expand_palette(png_structrp png_ptr, png_row_infop row_info, dp = row + (size_t)(row_width * 3) - 1; i = 0; #ifdef PNG_ARM_NEON_INTRINSICS_AVAILABLE - i = png_do_expand_palette_neon_rgb(png_ptr, row_info, row, + i = png_do_expand_palette_rgb8_neon(png_ptr, row_info, row, &sp, &dp); +#else + PNG_UNUSED(png_ptr) #endif for (; i < row_width; i++) @@ -4770,19 +4774,17 @@ png_do_read_transformations(png_structrp png_ptr, png_row_infop row_info) #ifdef PNG_ARM_NEON_INTRINSICS_AVAILABLE if ((png_ptr->num_trans > 0) && (png_ptr->bit_depth == 8)) { - /* Allocate space for the decompressed full palette. */ if (png_ptr->riffled_palette == NULL) { - png_ptr->riffled_palette = png_malloc(png_ptr, 256*4); - if (png_ptr->riffled_palette == NULL) - png_error(png_ptr, "NULL row buffer"); - /* Build the RGBA palette. */ - png_riffle_palette_rgba(png_ptr, row_info); + /* Initialize the accelerated palette expansion. */ + png_ptr->riffled_palette = + (png_bytep)png_malloc(png_ptr, 256 * 4); + png_riffle_palette_neon(png_ptr); } } #endif png_do_expand_palette(png_ptr, row_info, png_ptr->row_buf + 1, - png_ptr->palette, png_ptr->trans_alpha, png_ptr->num_trans); + png_ptr->palette, png_ptr->trans_alpha, png_ptr->num_trans); } else diff --git a/src/3rdparty/libpng/pngstruct.h b/src/3rdparty/libpng/pngstruct.h index 94a6d041fff..8bdc7ce46db 100644 --- a/src/3rdparty/libpng/pngstruct.h +++ b/src/3rdparty/libpng/pngstruct.h @@ -1,7 +1,7 @@ /* pngstruct.h - header file for PNG reference library * - * Copyright (c) 2018 Cosmin Truta + * Copyright (c) 2018-2019 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -228,10 +228,6 @@ struct png_struct_def * big_row_buf; while writing it is separately * allocated. */ -#ifdef PNG_READ_EXPAND_SUPPORTED - /* Buffer to accelerate palette transformations. */ - png_bytep riffled_palette; -#endif #ifdef PNG_WRITE_FILTER_SUPPORTED png_bytep try_row; /* buffer to save trial row when filtering */ png_bytep tst_row; /* buffer to save best trial row when filtering */ @@ -396,6 +392,12 @@ struct png_struct_def /* deleted in 1.5.5: rgb_to_gray_blue_coeff; */ #endif +/* New member added in libpng-1.6.36 */ +#if defined(PNG_READ_EXPAND_SUPPORTED) && \ + defined(PNG_ARM_NEON_IMPLEMENTATION) + png_bytep riffled_palette; /* buffer for accelerated palette expansion */ +#endif + /* New member added in libpng-1.0.4 (renamed in 1.0.9) */ #if defined(PNG_MNG_FEATURES_SUPPORTED) /* Changed from png_byte to png_uint_32 at version 1.2.0 */ diff --git a/src/3rdparty/libpng/pngwrite.c b/src/3rdparty/libpng/pngwrite.c index 160c877d385..59377a4ddea 100644 --- a/src/3rdparty/libpng/pngwrite.c +++ b/src/3rdparty/libpng/pngwrite.c @@ -1,7 +1,7 @@ /* pngwrite.c - general routines to write a PNG file * - * Copyright (c) 2018 Cosmin Truta + * Copyright (c) 2018-2019 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -948,10 +948,6 @@ png_write_destroy(png_structrp png_ptr) png_free_buffer_list(png_ptr, &png_ptr->zbuffer_list); png_free(png_ptr, png_ptr->row_buf); png_ptr->row_buf = NULL; -#ifdef PNG_READ_EXPANDED_SUPPORTED - png_free(png_ptr, png_ptr->riffled_palette); - png_ptr->riffled_palette = NULL; -#endif #ifdef PNG_WRITE_FILTER_SUPPORTED png_free(png_ptr, png_ptr->prev_row); png_free(png_ptr, png_ptr->try_row); diff --git a/src/3rdparty/libpng/qt_attribution.json b/src/3rdparty/libpng/qt_attribution.json index a0fd149bf41..b13f0c35273 100644 --- a/src/3rdparty/libpng/qt_attribution.json +++ b/src/3rdparty/libpng/qt_attribution.json @@ -6,7 +6,7 @@ "Description": "libpng is the official PNG reference library.", "Homepage": "http://www.libpng.org/pub/png/libpng.html", - "Version": "1.6.36", + "Version": "1.6.37", "License": "libpng License and libpng License 2", "LicenseId": "Libpng AND Libpng2", "LicenseFile": "LICENSE", @@ -14,7 +14,7 @@ Copyright (c) 2000-2017 Simon-Pierre Cadieux Copyright (c) 2000-2017 Eric S. Raymond Copyright (c) 2000-2017 Mans Rullgard -Copyright (c) 2000-2017 Cosmin Truta +Copyright (c) 2000-2019 Cosmin Truta Copyright (c) 2000-2017 Gilles Vollant Copyright (c) 2000-2017 James Yu Copyright (c) 2000-2017 Mandar Sahastrabuddhe diff --git a/src/3rdparty/libpng/qtpatches.diff b/src/3rdparty/libpng/qtpatches.diff index 508d5874e44..7ec8388ed0f 100644 --- a/src/3rdparty/libpng/qtpatches.diff +++ b/src/3rdparty/libpng/qtpatches.diff @@ -1,5 +1,5 @@ diff --git a/src/3rdparty/libpng/pngpriv.h b/src/3rdparty/libpng/pngpriv.h -index 3581f67919..e43862a886 100644 +index 583c26f9bd..2ab9b70d73 100644 --- a/src/3rdparty/libpng/pngpriv.h +++ b/src/3rdparty/libpng/pngpriv.h @@ -23,6 +23,12 @@ @@ -15,7 +15,7 @@ index 3581f67919..e43862a886 100644 /* Feature Test Macros. The following are defined here to ensure that correctly * implemented libraries reveal the APIs libpng needs to build and hide those * that are not needed and potentially damaging to the compilation. -@@ -305,6 +311,11 @@ +@@ -308,6 +314,11 @@ # endif #endif /* Setting PNG_BUILD_DLL if required */ @@ -27,7 +27,7 @@ index 3581f67919..e43862a886 100644 /* See pngconf.h for more details: the builder of the library may set this on * the command line to the right thing for the specific compilation system or it * may be automagically set above (at present we know of no system where it does -@@ -543,6 +554,9 @@ +@@ -546,6 +557,9 @@ #if defined(WIN32) || defined(_Windows) || defined(_WINDOWS) || \ defined(_WIN32) || defined(__WIN32__) # include /* defines _WINDOWS_ macro */ @@ -37,7 +37,7 @@ index 3581f67919..e43862a886 100644 #endif #endif /* PNG_VERSION_INFO_ONLY */ -@@ -553,7 +567,7 @@ +@@ -556,7 +570,7 @@ /* Memory model/platform independent fns */ #ifndef PNG_ABORT From 3308a81942d33f524b3fc61492bd67c4e2b9072d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tony=20Saraj=C3=A4rvi?= Date: Mon, 29 Apr 2019 11:49:28 +0300 Subject: [PATCH 03/10] Extend blacklisting of setWindowState to cover RHELs Task-number: QTBUG-68864 Change-Id: I7503877fbbe6109806d9fd087514588d2ac640c7 Reviewed-by: Heikki Halmet --- tests/auto/widgets/kernel/qwidget_window/BLACKLIST | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/widgets/kernel/qwidget_window/BLACKLIST b/tests/auto/widgets/kernel/qwidget_window/BLACKLIST index c980325d9a3..934f2e80257 100644 --- a/tests/auto/widgets/kernel/qwidget_window/BLACKLIST +++ b/tests/auto/widgets/kernel/qwidget_window/BLACKLIST @@ -5,3 +5,4 @@ ubuntu-16.04 ubuntu-18.04 [setWindowState] ubuntu-18.04 +rhel From e5eaae100b35d97f22a388831a5b9cd712053f3f Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Fri, 26 Apr 2019 15:16:18 +0200 Subject: [PATCH 04/10] Refactor QMetaObject::activate tracepoints Use Q_TRACE_SCOPE and the corresponding naming scheme. Additionally, don't change the behavior of the code when tracing is enabled, i.e. continue to return early if possible. Change-Id: I9ba9679869db1541a19bc832beede902224c52f2 Reviewed-by: Thiago Macieira --- src/corelib/kernel/qobject.cpp | 34 +++++++++++++++++----------------- src/corelib/qtcore.tracepoints | 16 ++++++++-------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 2a05f7f3839..68c5460b6a8 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -3664,19 +3664,18 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i if (sender->d_func()->blockSig) return; + Q_TRACE_SCOPE(QMetaObject_activate, sender, signal_index); + if (sender->d_func()->isDeclarativeSignalConnected(signal_index) && QAbstractDeclarativeData::signalEmitted) { - Q_TRACE(QMetaObject_activate_begin_declarative_signal, sender, signal_index); + Q_TRACE_SCOPE(QMetaObject_activate_declarative_signal, sender, signal_index); QAbstractDeclarativeData::signalEmitted(sender->d_func()->declarativeData, sender, signal_index, argv); - Q_TRACE(QMetaObject_activate_end_declarative_signal, sender, signal_index); } if (!sender->d_func()->isSignalConnected(signal_index, /*checkDeclarative =*/ false) && !qt_signal_spy_callback_set.signal_begin_callback - && !qt_signal_spy_callback_set.signal_end_callback - && !Q_TRACE_ENABLED(QMetaObject_activate_begin_signal) - && !Q_TRACE_ENABLED(QMetaObject_activate_end_signal)) { + && !qt_signal_spy_callback_set.signal_end_callback) { // The possible declarative connection is done, and nothing else is connected, so: return; } @@ -3686,7 +3685,6 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i qt_signal_spy_callback_set.signal_begin_callback(sender, signal_index, argv ? argv : empty_argv); } - Q_TRACE(QMetaObject_activate_begin_signal, sender, signal_index); { QMutexLocker locker(signalSlotLock(sender)); @@ -3717,7 +3715,6 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i locker.unlock(); if (qt_signal_spy_callback_set.signal_end_callback != 0) qt_signal_spy_callback_set.signal_end_callback(sender, signal_index); - Q_TRACE(QMetaObject_activate_end_signal, sender, signal_index); return; } @@ -3778,9 +3775,11 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i c->slotObj->ref(); QScopedPointer obj(c->slotObj); locker.unlock(); - Q_TRACE(QMetaObject_activate_begin_slot_functor, obj.data()); - obj->call(receiver, argv ? argv : empty_argv); - Q_TRACE(QMetaObject_activate_end_slot_functor, obj.data()); + + { + Q_TRACE_SCOPE(QMetaObject_activate_slot_functor, obj.data()); + obj->call(receiver, argv ? argv : empty_argv); + } // Make sure the slot object gets destroyed before the mutex is locked again, as the // destructor of the slot object might also lock a mutex from the signalSlotLock() mutex pool, @@ -3796,11 +3795,12 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i locker.unlock(); if (qt_signal_spy_callback_set.slot_begin_callback != 0) qt_signal_spy_callback_set.slot_begin_callback(receiver, methodIndex, argv ? argv : empty_argv); - Q_TRACE(QMetaObject_activate_begin_slot, receiver, methodIndex); - callFunction(receiver, QMetaObject::InvokeMetaMethod, method_relative, argv ? argv : empty_argv); + { + Q_TRACE_SCOPE(QMetaObject_activate_slot, receiver, methodIndex); + callFunction(receiver, QMetaObject::InvokeMetaMethod, method_relative, argv ? argv : empty_argv); + } - Q_TRACE(QMetaObject_activate_end_slot, receiver, methodIndex); if (qt_signal_spy_callback_set.slot_end_callback != 0) qt_signal_spy_callback_set.slot_end_callback(receiver, methodIndex); locker.relock(); @@ -3813,11 +3813,12 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i method, argv ? argv : empty_argv); } - Q_TRACE(QMetaObject_activate_begin_slot, receiver, method); - metacall(receiver, QMetaObject::InvokeMetaMethod, method, argv ? argv : empty_argv); + { + Q_TRACE_SCOPE(QMetaObject_activate_slot, receiver, method); + metacall(receiver, QMetaObject::InvokeMetaMethod, method, argv ? argv : empty_argv); + } - Q_TRACE(QMetaObject_activate_end_slot, receiver, method); if (qt_signal_spy_callback_set.slot_end_callback != 0) qt_signal_spy_callback_set.slot_end_callback(receiver, method); @@ -3838,7 +3839,6 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i if (qt_signal_spy_callback_set.signal_end_callback != 0) qt_signal_spy_callback_set.signal_end_callback(sender, signal_index); - Q_TRACE(QMetaObject_activate_end_signal, sender, signal_index); } /*! diff --git a/src/corelib/qtcore.tracepoints b/src/corelib/qtcore.tracepoints index 3a70136741b..70789500278 100644 --- a/src/corelib/qtcore.tracepoints +++ b/src/corelib/qtcore.tracepoints @@ -32,13 +32,13 @@ QCoreApplication_notify_after_delivery(QObject *receiver, QEvent *event, int typ QObject_ctor(QObject *object) QObject_dtor(QObject *object) -QMetaObject_activate_begin_signal(QObject *sender, int signalIndex) -QMetaObject_activate_end_signal(QObject *sender, int signalIndex) -QMetaObject_activate_begin_slot(QObject *receiver, int slotIndex) -QMetaObject_activate_end_slot(QObject *receiver, int slotIndex) -QMetaObject_activate_begin_slot_functor(void *slotObject) -QMetaObject_activate_end_slot_functor(void *slotObject) -QMetaObject_activate_begin_declarative_signal(QObject *sender, int signalIndex) -QMetaObject_activate_end_declarative_signal(QObject *sender, int signalIndex) +QMetaObject_activate_entry(QObject *sender, int signalIndex) +QMetaObject_activate_exit(QObject *sender, int signalIndex) +QMetaObject_activate_slot_entry(QObject *receiver, int slotIndex) +QMetaObject_activate_slot_exit(QObject *receiver, int slotIndex) +QMetaObject_activate_slot_functor_entry(void *slotObject) +QMetaObject_activate_slot_functor_exit(void *slotObject) +QMetaObject_activate_declarative_signal_entry(QObject *sender, int signalIndex) +QMetaObject_activate_declarative_signal_exit(QObject *sender, int signalIndex) qt_message_print(int type, const char *category, const char *function, const char *file, int line, const QString &message) From 75c0c026414239919603d6a5a35e333f257368c9 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Fri, 26 Apr 2019 15:21:12 +0200 Subject: [PATCH 05/10] Don't pass scope args to _exit trace points When we trace a scope, then we pass the scope args to the _entry trace point. There is no need to do that also for the _exit trace points, it just blows up the trace data for no obvious gain. Any decent tracing consumer can easily find the args for the _exit call by matching it to its _entry call. Note that this is standard practice in trace points, and also done like this in the Linux Kernel trace points for example. Change-Id: I273293b0c7e799767acc1960b50ab675fc765a36 Reviewed-by: Thiago Macieira --- src/corelib/global/qtrace_p.h | 2 +- src/corelib/qtcore.tracepoints | 12 ++++++------ src/gui/qtgui.tracepoints | 2 +- src/widgets/qtwidgets.tracepoints | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/corelib/global/qtrace_p.h b/src/corelib/global/qtrace_p.h index 20f2beac986..4cef126bb66 100644 --- a/src/corelib/global/qtrace_p.h +++ b/src/corelib/global/qtrace_p.h @@ -127,7 +127,7 @@ QT_BEGIN_NAMESPACE const auto qTraceExit_ ## x ## __COUNTER__ = qScopeGuard([&]() { Q_TRACE(x, __VA_ARGS__); }); # define Q_TRACE_SCOPE(x, ...) \ Q_TRACE(x ## _entry, __VA_ARGS__); \ - Q_TRACE_EXIT(x ## _exit, __VA_ARGS__); + Q_TRACE_EXIT(x ## _exit); # define Q_UNCONDITIONAL_TRACE(x, ...) QtPrivate::do_trace_ ## x(__VA_ARGS__) # define Q_TRACE_ENABLED(x) QtPrivate::trace_ ## x ## _enabled() #else diff --git a/src/corelib/qtcore.tracepoints b/src/corelib/qtcore.tracepoints index 70789500278..a1bc957fe53 100644 --- a/src/corelib/qtcore.tracepoints +++ b/src/corelib/qtcore.tracepoints @@ -16,7 +16,7 @@ QEvent_ctor(QEvent *event, int type) QEvent_dtor(QEvent *event, int type) QCoreApplication_postEvent_entry(QObject *receiver, QEvent *event, int type) -QCoreApplication_postEvent_exit(QObject *receiver, QEvent *event, int type) +QCoreApplication_postEvent_exit() QCoreApplication_postEvent_event_compressed(QObject *receiver, QEvent *event) QCoreApplication_postEvent_event_posted(QObject *receiver, QEvent *event, int type) @@ -24,7 +24,7 @@ QCoreApplication_sendEvent(QObject *receiver, QEvent *event, int type) QCoreApplication_sendSpontaneousEvent(QObject *receiver, QEvent *event, int type) QCoreApplication_notify_entry(QObject *receiver, QEvent *event, int type) -QCoreApplication_notify_exit(QObject *receiver, QEvent *event, int type) +QCoreApplication_notify_exit() QCoreApplication_notify_event_filtered(QObject *receiver, QEvent *event, int type) QCoreApplication_notify_before_delivery(QObject *receiver, QEvent *event, int type) QCoreApplication_notify_after_delivery(QObject *receiver, QEvent *event, int type, bool consumed) @@ -33,12 +33,12 @@ QObject_ctor(QObject *object) QObject_dtor(QObject *object) QMetaObject_activate_entry(QObject *sender, int signalIndex) -QMetaObject_activate_exit(QObject *sender, int signalIndex) +QMetaObject_activate_exit() QMetaObject_activate_slot_entry(QObject *receiver, int slotIndex) -QMetaObject_activate_slot_exit(QObject *receiver, int slotIndex) +QMetaObject_activate_slot_exit() QMetaObject_activate_slot_functor_entry(void *slotObject) -QMetaObject_activate_slot_functor_exit(void *slotObject) +QMetaObject_activate_slot_functor_exit() QMetaObject_activate_declarative_signal_entry(QObject *sender, int signalIndex) -QMetaObject_activate_declarative_signal_exit(QObject *sender, int signalIndex) +QMetaObject_activate_declarative_signal_exit() qt_message_print(int type, const char *category, const char *function, const char *file, int line, const QString &message) diff --git a/src/gui/qtgui.tracepoints b/src/gui/qtgui.tracepoints index 0a96a589b18..52916a3aa28 100644 --- a/src/gui/qtgui.tracepoints +++ b/src/gui/qtgui.tracepoints @@ -8,7 +8,7 @@ QGuiApplicationPrivate_init_entry() QGuiApplicationPrivate_init_exit() QGuiApplicationPrivate_processWindowSystemEvent_entry(int type) -QGuiApplicationPrivate_processWindowSystemEvent_exit(int type) +QGuiApplicationPrivate_processWindowSystemEvent_exit() QFontDatabase_addApplicationFont(const QString &filename) QFontDatabase_load(const QString &family, int pointSize) diff --git a/src/widgets/qtwidgets.tracepoints b/src/widgets/qtwidgets.tracepoints index 9c40cdb3e79..b99e46e33fd 100644 --- a/src/widgets/qtwidgets.tracepoints +++ b/src/widgets/qtwidgets.tracepoints @@ -5,7 +5,7 @@ QT_END_NAMESPACE } QApplication_notify_entry(QObject *receiver, QEvent *event, int type) -QApplication_notify_exit(QObject *receiver, QEvent *event, int type) +QApplication_notify_exit() QApplication_notify_event_filtered(QObject *receiver, QEvent *event, int type) QApplication_notify_before_delivery(QObject *receiver, QEvent *event, int type) QApplication_notify_after_delivery(QObject *receiver, QEvent *event, int type, bool consumed) From 0e4326d71724285ec6a295ea099a4bd06cd9aa1b Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 26 Apr 2019 09:39:57 +0200 Subject: [PATCH 06/10] Remove cruft from testProcessEOF.pro TEMPLATE_PREFIX is gone since Qt 5.0.0. Change-Id: I181962b942191187baf62f13d0abd17e7ebdcce1 Reviewed-by: Kai Koehne --- .../auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro b/tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro index ab1394a5c94..6a23e52d950 100644 --- a/tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro +++ b/tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro @@ -1,6 +1,4 @@ SOURCES = main.cpp CONFIG -= qt CONFIG += cmdline - -win32:!mingw:!equals(TEMPLATE_PREFIX, "vc"):QMAKE_CXXFLAGS += /GS- DESTDIR = ./ From 78d0b6e9756c732bf0a7b02d258313a1d2ab461e Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Fri, 26 Apr 2019 17:47:53 +0200 Subject: [PATCH 07/10] Ignore failing test for free space on APFS The file system appears to cache too aggressively, so if the reported storage size doesn't change after flushing to disk, ignore the failure. Change-Id: Iba7dce79591447fac296bfe92c2dc993d36d0c2a Fixes: QTBUG-69868 Reviewed-by: Thiago Macieira --- tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp b/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp index 1317489e2f3..fe63cecccd8 100644 --- a/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp +++ b/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp @@ -195,6 +195,10 @@ void tst_QStorageInfo::tempFile() file.close(); QStorageInfo storage2(file.fileName()); + if (free == storage2.bytesFree() && storage2.fileSystemType() == "apfs") { + QEXPECT_FAIL("", "This test is likely to fail on APFS", Continue); + } + QVERIFY(free != storage2.bytesFree()); } @@ -221,6 +225,9 @@ void tst_QStorageInfo::caching() QCOMPARE(free, storage2.bytesFree()); storage2.refresh(); QCOMPARE(storage1, storage2); + if (free == storage2.bytesFree() && storage2.fileSystemType() == "apfs") { + QEXPECT_FAIL("", "This test is likely to fail on APFS", Continue); + } QVERIFY(free != storage2.bytesFree()); } #endif From a04629d9c2afb0e075a8872793718832200ea26b Mon Sep 17 00:00:00 2001 From: Vova Mshanetskiy Date: Thu, 25 Apr 2019 18:39:38 +0300 Subject: [PATCH 08/10] Android: Fix positioning of selection handles in text editors The old code used size of m_cursorView to calculate position of the cursor handle popup. But since on Android layout process is asynchronous, both width and height of m_cursorView was 0 upon first call to setPosition(). This resulted in selection handles being initially displayed at a wrong position for a fraction of second and then quickly moving to the correct position. In some cases handles stayed at the wrong position until touched by user. This patch replaces use of m_cursorView's size with use of m_popup's size. Width and height of m_popup may be used immediately because they are explicitly assigned in initOverlay(). The size of m_popup should be always equal to the would-be size of m_cursorView because of how it is calculated. Change-Id: I9868c9a5ce0103d8328b2478cf82feaceba7f404 Reviewed-by: BogDan Vatra --- .../jar/src/org/qtproject/qt5/android/CursorHandle.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java b/src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java index 788a5c2b3d2..38cc695c371 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java +++ b/src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java @@ -166,11 +166,11 @@ public class CursorHandle implements ViewTreeObserver.OnPreDrawListener int y2 = y + location[1] + m_yShift; if (m_id == QtNative.IdCursorHandle) { - x2 -= m_cursorView.getWidth() / 2 ; + x2 -= m_popup.getWidth() / 2 ; } else if ((m_id == QtNative.IdLeftHandle && !m_rtl) || (m_id == QtNative.IdRightHandle && m_rtl)) { - x2 -= m_cursorView.getWidth() * 3 / 4; + x2 -= m_popup.getWidth() * 3 / 4; } else { - x2 -= m_cursorView.getWidth() / 4; + x2 -= m_popup.getWidth() / 4; } if (m_popup.isShowing()) { From 5f4b03659b1e2318acb87fd9bf7325f707dfa0ad Mon Sep 17 00:00:00 2001 From: Vova Mshanetskiy Date: Thu, 25 Apr 2019 20:34:13 +0300 Subject: [PATCH 09/10] Android: Fix positioning of text editor context menu The old code in QtActivityDelegate.updateHandles() and EditPopupMenu.setPosition() could use size of EditPopupMenu.m_view to calculate position of context menu before that size was calculated during an asynchronous layout pass. In particular m_view reports size 0x0 when context menu is opened for the first time after start of the application. In this case the context menu was displayed on top of the text editor instead of being displayed above it. This patch fixes that problem by moving all positioning code from QtActivityDelegate.updateHandles() to EditPopupMenu.setPosition() and adding an OnLayoutChangeListener which calls setPosition() again each time the size of m_view changes, including when it changes for the first time from 0x0 to a real value. Change-Id: I670fef811a4dcba5524f7520ea41a47978dd10f1 Reviewed-by: BogDan Vatra --- .../qtproject/qt5/android/EditPopupMenu.java | 38 +++++++++++++++---- .../qt5/android/QtActivityDelegate.java | 12 +----- 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/src/android/jar/src/org/qtproject/qt5/android/EditPopupMenu.java b/src/android/jar/src/org/qtproject/qt5/android/EditPopupMenu.java index d065cd8549a..18a8b36273f 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/EditPopupMenu.java +++ b/src/android/jar/src/org/qtproject/qt5/android/EditPopupMenu.java @@ -59,7 +59,8 @@ import android.view.ViewGroup; import android.R; // Helper class that manages a cursor or selection handle -public class EditPopupMenu implements ViewTreeObserver.OnPreDrawListener, EditContextView.OnClickListener +public class EditPopupMenu implements ViewTreeObserver.OnPreDrawListener, View.OnLayoutChangeListener, + EditContextView.OnClickListener { private View m_layout = null; private EditContextView m_view = null; @@ -67,10 +68,15 @@ public class EditPopupMenu implements ViewTreeObserver.OnPreDrawListener, EditCo private int m_posX; private int m_posY; private int m_buttons; + private CursorHandle m_cursorHandle; + private CursorHandle m_leftSelectionHandle; + private CursorHandle m_rightSelectionHandle; public EditPopupMenu(Activity activity, View layout) { m_view = new EditContextView(activity, this); + m_view.addOnLayoutChangeListener(this); + m_layout = layout; } @@ -90,13 +96,9 @@ public class EditPopupMenu implements ViewTreeObserver.OnPreDrawListener, EditCo m_layout.getViewTreeObserver().addOnPreDrawListener(this); } - public int getHeight() - { - return m_view.getHeight(); - } - // Show the handle at a given position (or move it if it is already shown) - public void setPosition(final int x, final int y, final int buttons) + public void setPosition(final int x, final int y, final int buttons, + CursorHandle cursorHandle, CursorHandle leftSelectionHandle, CursorHandle rightSelectionHandle) { initOverlay(); @@ -109,6 +111,14 @@ public class EditPopupMenu implements ViewTreeObserver.OnPreDrawListener, EditCo x2 -= m_view.getWidth() / 2 ; + y2 -= m_view.getHeight(); + if (y2 < 0) { + if (cursorHandle != null) + y2 = cursorHandle.bottom(); + else if (leftSelectionHandle != null && rightSelectionHandle != null) + y2 = Math.max(leftSelectionHandle.bottom(), rightSelectionHandle.bottom()); + } + if (m_layout.getWidth() < x + m_view.getWidth() / 2) x2 = m_layout.getWidth() - m_view.getWidth(); @@ -123,6 +133,9 @@ public class EditPopupMenu implements ViewTreeObserver.OnPreDrawListener, EditCo m_posX = x; m_posY = y; m_buttons = buttons; + m_cursorHandle = cursorHandle; + m_leftSelectionHandle = leftSelectionHandle; + m_rightSelectionHandle = rightSelectionHandle; } public void hide() { @@ -138,11 +151,20 @@ public class EditPopupMenu implements ViewTreeObserver.OnPreDrawListener, EditCo // For example if the keyboard appears. // Adjust the position of the handle accordingly if (m_popup != null && m_popup.isShowing()) - setPosition(m_posX, m_posY, m_buttons); + setPosition(m_posX, m_posY, m_buttons, m_cursorHandle, m_leftSelectionHandle, m_rightSelectionHandle); return true; } + @Override + public void onLayoutChange(View v, int left, int top, int right, int bottom, + int oldLeft, int oldTop, int oldRight, int oldBottom) + { + if ((right - left != oldRight - oldLeft || bottom - top != oldBottom - oldTop) && + m_popup != null && m_popup.isShowing()) + setPosition(m_posX, m_posY, m_buttons, m_cursorHandle, m_leftSelectionHandle, m_rightSelectionHandle); + } + @Override public void contextButtonClicked(int buttonId) { switch (buttonId) { diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java index 5fef1eccadd..f776888652a 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -553,16 +553,8 @@ public class QtActivityDelegate editButtons &= ~EditContextView.PASTE_BUTTON; if ((mode & CursorHandleShowEdit) == CursorHandleShowEdit && editButtons != 0) { - editY -= m_editPopupMenu.getHeight(); - if (editY < 0) { - if (m_cursorHandle != null) - editY = m_cursorHandle.bottom(); - else if (m_leftSelectionHandle != null && m_rightSelectionHandle != null) - editY = Math.max(m_leftSelectionHandle.bottom(), m_rightSelectionHandle.bottom()); - else - return; - } - m_editPopupMenu.setPosition(editX, editY, editButtons); + m_editPopupMenu.setPosition(editX, editY, editButtons, m_cursorHandle, m_leftSelectionHandle, + m_rightSelectionHandle); } else { if (m_editPopupMenu != null) m_editPopupMenu.hide(); From ef3daddae1720956e746142ac7ee54a27b9299d7 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Thu, 28 Mar 2019 17:32:23 +0300 Subject: [PATCH 10/10] Use QPlatformTheme::TouchDoubleTapDistance for touch events ... and update the cached values on theme change. Modify tst_QWidget::touchEventSynthesizedMouseEvent() to avoid unexpected double click detection. Change-Id: I151c47e851ebba7550b1b09caca2781c28d7d3d9 Reviewed-by: Shawn Rutledge --- src/gui/kernel/qguiapplication.cpp | 20 ++++++++++++++----- src/gui/kernel/qguiapplication_p.h | 1 - .../widgets/kernel/qwidget/tst_qwidget.cpp | 10 ++++++---- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 424af20f26a..a67214bd9ae 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -181,7 +181,9 @@ ulong QGuiApplicationPrivate::mousePressTime = 0; Qt::MouseButton QGuiApplicationPrivate::mousePressButton = Qt::NoButton; int QGuiApplicationPrivate::mousePressX = 0; int QGuiApplicationPrivate::mousePressY = 0; -int QGuiApplicationPrivate::mouse_double_click_distance = -1; + +static int mouseDoubleClickDistance = -1; +static int touchDoubleTapDistance = -1; QWindow *QGuiApplicationPrivate::currentMousePressWindow = 0; @@ -257,6 +259,12 @@ static inline void clearFontUnlocked() QGuiApplicationPrivate::app_font = 0; } +static void initThemeHints() +{ + mouseDoubleClickDistance = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::MouseDoubleClickDistance).toInt(); + touchDoubleTapDistance = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::TouchDoubleTapDistance).toInt(); +} + static bool checkNeedPortalSupport() { #if QT_CONFIG(dbus) @@ -1519,8 +1527,7 @@ void QGuiApplicationPrivate::init() initPalette(); QFont::initialize(); - - mouse_double_click_distance = platformTheme()->themeHint(QPlatformTheme::MouseDoubleClickDistance).toInt(); + initThemeHints(); #ifndef QT_NO_CURSOR QCursorData::initialize(); @@ -2030,8 +2037,10 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo if (mouseMove) { QGuiApplicationPrivate::lastCursorPosition = globalPoint; - if (qAbs(globalPoint.x() - mousePressX) > mouse_double_click_distance|| - qAbs(globalPoint.y() - mousePressY) > mouse_double_click_distance) + const auto doubleClickDistance = e->source == Qt::MouseEventNotSynthesized ? + mouseDoubleClickDistance : touchDoubleTapDistance; + if (qAbs(globalPoint.x() - mousePressX) > doubleClickDistance || + qAbs(globalPoint.y() - mousePressY) > doubleClickDistance) mousePressButton = Qt::NoButton; } else { mouse_buttons = e->buttons; @@ -3988,6 +3997,7 @@ void QGuiApplicationPrivate::notifyThemeChanged() clearFontUnlocked(); initFontUnlocked(); } + initThemeHints(); } void QGuiApplicationPrivate::sendApplicationPaletteChange(bool toAllWidgets, const char *className) diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index 042a36c31fa..482d45e5c3b 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -211,7 +211,6 @@ public: static Qt::MouseButton mousePressButton; static int mousePressX; static int mousePressY; - static int mouse_double_click_distance; static QPointF lastCursorPosition; static QWindow *currentMouseWindow; static QWindow *currentMousePressWindow; diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 3b9c9060fa3..780cb01e404 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -10152,7 +10152,8 @@ void tst_QWidget::touchEventSynthesizedMouseEvent() // We should see propagation of the TouchBegin into a MouseButtonPress TouchMouseWidget parent; TouchMouseWidget child(&parent); - child.move(5, 5); + const QPoint childPos(5, 5); + child.move(childPos); child.setAcceptMouse(false); parent.show(); QVERIFY(QTest::qWaitForWindowExposed(parent.windowHandle())); @@ -10161,13 +10162,14 @@ void tst_QWidget::touchEventSynthesizedMouseEvent() QCOMPARE(child.m_touchEventCount, 0); QCOMPARE(child.m_mouseEventCount, 0); - QTest::touchEvent(parent.window(), m_touchScreen).press(0, QPoint(10, 10), &child); + const QPoint touchPos(20, 20); + QTest::touchEvent(parent.window(), m_touchScreen).press(0, touchPos, &child); QCOMPARE(parent.m_touchEventCount, 0); QCOMPARE(parent.m_mouseEventCount, 1); - QCOMPARE(parent.m_lastMouseEventPos, QPointF(15, 15)); + QCOMPARE(parent.m_lastMouseEventPos, childPos + touchPos); QCOMPARE(child.m_touchEventCount, 0); QCOMPARE(child.m_mouseEventCount, 1); // Attempt at mouse event before propagation - QCOMPARE(child.m_lastMouseEventPos, QPointF(10, 10)); + QCOMPARE(child.m_lastMouseEventPos, touchPos); } }