Commit Graph

26509 Commits

Author SHA1 Message Date
Sérgio Martins
a1702da020 Don't detach QGradientStops
Change-Id: I1ae84d0ae825e9fb474d4fab45b0c475a3878b25
Reviewed-by: David Faure <david.faure@kdab.com>
2016-01-05 15:00:49 +00:00
Alex Trotsenko
9f74b840f9 QAbstractSocket: remove unused 'connectTimeElapsed' member
Change-Id: If73198fb034b6a52b5081379a2bc69052d307454
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-01-05 13:05:46 +00:00
Maurice Kalinowski
e0cc6e5b8e winphone: Invoke windeployqt twice unconditionally for vcproj
In 50bf54c invoking windeployqt was only required in release mode as
MDILXapCompile was not invoked for debug builds with Visual Studio 2013.
However, Visual Studio 2015 invokes MDILXapCompile for debug and
release. Hence we have to use this workaround unconditionally.

Also we cannot limit this to msvc2015 host specs only, as older projects
still might be loaded with Visual Studio 2015 causing the build to
break.

Task-number: QTBUG-49815
Change-Id: Ia120a392967319b945a9746ad489f2db0eed7156
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-01-05 13:05:00 +00:00
Maurice Kalinowski
3c086e50d3 winrt: handle PrelaunchActivated property to pass certification
Windows 10 requires apps to handle the PrelaunchActivated property. This
enables a faster startup by launching an app and immediately suspending
it. This happens by the system and at the time the user launches the app
no library loading or initialization is required.

By default we opt-out of this and return early. The reason is that we
cannot know the type of application written in Qt and whether it breaks
the guidelines by using prelaunch. For further details check here:
https://msdn.microsoft.com/en-us/library/windows/apps/mt593297.aspx

Task-number: QTBUG-50292
Change-Id: I4d0b0b95a03f93b99211d042895404a88ea7cb9d
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-01-05 13:04:09 +00:00
Ulf Hermann
9d6a4e7094 QLocale: Accept trailing junk in qstrtod()
qstrtod() used to accept trailing junk until libdouble-conversion was
introduced and we need this behavior in order to implement EcmaScript's
parseFloat() correctly. The QString and QByteArray methods should not
accept trailing junk, though.

Task-number: QTBUG-50131
Change-Id: Ide922da0d65b2576be2c9f47f6053057eff77994
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-05 11:29:29 +00:00
Marc Mutz
8b2f133822 QFactoryLoader: generalize qLoadPlugin()
- Use perfect forwarding for the additional argument.
- Provide a variadic template version
- Deprecate qLoadPlugin1() — there's no reason for a different name
  — and fix all callers in qtbase.
- Provide non-variadic overloads for up to three additional args
  (QPlatformIntegration rolled its own function because it needs
  three args).

Change-Id: I72fb2dd9a021de704cbf5e4b6ea31c80447fb3b1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-05 10:28:27 +00:00
Marc Mutz
32bd53c6b1 QStateMachine: replace a QPair with a small struct
The use of QPair made the return type of initializeAnimation()
so complicated, that the original author opted to declare the
pair on one line, then assign to it in the next, to keep below
the line length limit.

She also copied a member of the pair just so as to give it a
descriptive name.

Fix both by introducing a small result struct. It has a nicer
name, compared to the pair, but still port callers to use 'auto'.
The member names are descriptive enough now.

Saves more than 0.5KiB in text size on optimized GCC 4.9 Linux
AMD64 builds, too.

Change-Id: I7ed007ffa0fb16e182e38cd405cfd54da4e363fb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2016-01-05 10:28:09 +00:00
Marc Mutz
01d8abdbf1 [docs] Gently steer people away from QPair
Change-Id: Ib0fb69f856606612d516426732f619422630c93f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-05 10:25:05 +00:00
Oliver Wolff
275f182872 winrt: Added timeout to await function
Instead of using a "custom wait function" in cases,
where a timeout is needed (like in qhostinfo_winrt.cpp)
we should have the timeout as part of our await
function.

By having one common place to handle this, we can avoid
unnecessary warnings, that might be caused by custom
functions. The current implementation in qhostinfo
for example causes at least 1 "originate error"
exception per call.

Change-Id: I7b6cfdfd861af2b0d271465eecaefe4a93e3109b
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
2016-01-05 08:14:37 +00:00
Oliver Wolff
452a27e1f0 Winrt: Show message when command line processing fails/usage should be shown
Change-Id: If8f69906beb22f632ccbde92aab5caf914dcb31b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-01-05 08:14:35 +00:00
Oliver Wolff
47b5b5d106 winrt: Use "await" with its timeout for dns queries
By using await instead of using a custom wait function we
get rid of a lot of "function was called at an unexpected
time" warnings and use the default way of waiting for an
asynchronous function to complete.

Change-Id: I6c5bf73ccf68a219b8f3facd3531873d7e8d4c67
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
2016-01-05 08:14:32 +00:00
Oliver Wolff
190c76f685 winrt: Use winsock2 API for hostname resolution on WinRT/WinPhone
That API has been available for WinRT and Windows
Phone for some time now. By using it to get the
machine name and for hostname resolution we can get
rid of some winrt-only code and use qhostinfo_win.cpp
on WinRT and Windows phone as well.

Additionally the required capability was added to
tst_qhostinfo so that this auto test can be run without
any manual editing.

Change-Id: I63fa5521bf8cdb0c919bd5a0100ea977c865622a
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
2016-01-05 08:14:31 +00:00
Samuel Nevala
2ca20724dd WinRT: Add camera button events on Windows Phone
Windows Phone 8.1 provides access to the camera button and press/release
events get passed as Key_CameraFocus and Key_Camera. Unfortunately a
release does not provide what has been pressed before, hence this
information needs to be cached when the press happens.

Done-with: Maurice Kalinowski<maurice.kalinowski@theqtcompany.com>
Task-number: QTBUG-39115
Change-Id: I6ce58a1f07a6bf7183b8d99a26e5cd7b0d32d6db
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
Reviewed-by: Samuel Nevala <samuel.nevala@intopalo.com>
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-01-05 08:14:28 +00:00
Timur Pocheptsov
4ed8733d90 tst_Gesture - fix failing tests on OS X 10.11
This test seems to be quite broken on OS X: qWaitForWindowExposed returns
too early (while no window is on screen) so gestures can not be dispatched
QApplication::topLevelAt(pt) - returns null.
Use qWait + isExposed combo instead (similar to qWaitForWindowExposed, but
there is no isExposed test before the loop).

Change-Id: I85fbd773ccce0ca92b2dceb1749d67ef767aa0cf
Task-number: QTBUG-49849
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
2016-01-05 06:08:18 +00:00
Timur Pocheptsov
60c333caba QMacPanGestureRecognizer - stop timer on 'reset'
_panTimer has a target - for example, widget. 'reset' should stop this timer.
The problem (quite subtle and difficult to reproduce) found in tst_QTouchEvent:
widgets created/destoryed by different tests but we still can have a timer
waiting for event dispatcher to 'processEvents', firing with now-invalid
dangling pointer - 'target'.

Change-Id: Iccaf3368a8ee6a0a2f60e9dcdf5d40fb7392ca21
Task-number: QTBUG-49844
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
2016-01-05 06:08:03 +00:00
Marc Mutz
a3ce123549 QtCore: eradicate all Q_FOREACH loops [tools]
Saves just under 5.5KiB in text size on optimized GCC 4.9 Linux
AMD64 builds.

Change-Id: I6d868a7d2e469cf0564127b0e66cd7b272a0c9cd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-04 20:35:38 +00:00
Marc Mutz
5feebcc973 QMimeDatabase: replace a QStack<QString> with std::stack<QString, QStringList>
A QStringList is almost as efficient as a QVector<QString>.
More importantly, the QStringList case can share code with
the myriad of other QStringList users, in particular
because std::stack is but the thinnest of wrappers around
its underlying container.

Saves 1400b in text size on optimized GCC 4.9 Linux AMD64
builds.

Change-Id: If37ed55802aa8a529ca772df465990ded0aaba7f
Reviewed-by: David Faure <david.faure@kdab.com>
2016-01-04 20:35:33 +00:00
Marc Mutz
cc2ea22a30 QMimeAllGlobPatterns: optimize string handling in matchingGlobs()
... by not re-creating the same string in every loop iteration.

Change-Id: If17c5980bec8276b531267b309578dac8901c93e
Reviewed-by: David Faure <david.faure@kdab.com>
2016-01-04 20:35:28 +00:00
Mauro Persano
0cee94017f QOpenGLTexture: fix target for compressed textures
Trying to set data for a compressed cubemap texture face fails, because
the code incorrectly tries to bind to a cubemap face target.

This was already fixed for uncompressed textures. Instead of duplicating
the code, moved the texture binding/unbinding code to a RAII class.

Change-Id: I8f1cb7fc661b919200f85c3465d6e6e3c22d0871
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2016-01-04 19:49:34 +00:00
Sebastian Lösch
73ad2bf32f Make ephemeral server key available
When using cipher algorithms with forward secrecy an ephemeral key is
used to generate the symmetric session key. Beside the SSL certificate's
key, this ephemeral key is of cryptographic interest.

The ephemeral key is chosen by the server side - currently statically in
the Qt implementation - so it is only of interest on the client side to
check it. Therefore the ephemeral key is the null key if the connection
is set up in server mode or a cipher without forward secrecy is used.

Change-Id: If241247dbb8490a91233ae47f2b38952c6591bf4
Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com>
2016-01-04 18:10:14 +00:00
Friedemann Kleint
0c60dda872 QWindowsTheme: Fix return type of helper dWordSystemParametersInfo().
QApplication::wheelScrollLines() was always 1 due it being a bool.

Task-number: QTBUG-49561
Change-Id: I83e97da3507c31dfd024db7bf543c4e6a3b4a98b
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-01-04 16:28:31 +00:00
Mitch Curtis
c19216cbea Fix QPainter::rotate() documentation
Change-Id: I5d11f84181cad9be644e850c83459b47ec2f2f15
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-01-04 16:25:58 +00:00
Edward Welbourne
374d35d5ba Make use of preprocessor easier to understand.
The #if had a condition that was needlessly hard to understand;
and was widely separated from its #else clause.

Change-Id: I43f4282993f4f2e8c4b5ad07dc2c2e06a6b95aa9
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-01-04 13:59:14 +00:00
Alex Trotsenko
a9e1fc29ca Remove Windows-specific handling of the write notifiers on sockets
There is no need in special OS dependent code now, because the
socket notifiers got the identical behavior on all platforms.

Change-Id: I53ee51cd5eeff328e0b73f7325d2c9e883c5b213
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-01-04 13:43:01 +00:00
André Klitzing
0cd73f23f2 Print correct OS name if it is a server version
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724833%28v=vs.85%29.aspx

Change-Id: I7ee4c78959696ee2b662899a6a1408cfd1ebcacd
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-01-04 13:29:31 +00:00
André Klitzing
a862474839 Print out "Service Pack" version of underlying Windows
Change-Id: I1f7dbf8f1244e8b7bf2f459fdce381838d776dbe
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-01-04 13:29:26 +00:00
Błażej Szczygieł
eaa3a9d010 Fix crash because of NULL screen in QXcbWindow
Change-Id: If7bbe3ad1656dadcb098bcd3ece2e7b064eeb44d
Task-number: QTBUG-50081
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
2016-01-04 13:22:39 +00:00
Samuel Nevala
7fdfaad43f Fix deadlock when setting environment variables.
Qt uses QHash as the container for faking environment variables on
Windows Runtime and CE. Environment variable manipulation functions are
protected by mutex. Accessing the QT_HASH_SEED environment variable
inside QHash can lead to situation where qputenv() call leads to
qgetenv() call and that leads to a deadlock. Change the container
from QHash to QVector to avoid deadlock.

Task-number: QTBUG-49529
Change-Id: I550ead4ab12e7abebc044f52339063a44fcf0170
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
2016-01-04 13:12:19 +00:00
Timur Pocheptsov
b12e876efc tst_qwindow::isExposed - fix failing test on OS X
Change-Id: Ice25c8ffaaa4662b679ee829dc0a38834e3258b7
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
2016-01-04 13:03:03 +00:00
Marc Mutz
5d849880f4 QNetworkReplyHttpImpl: convert another QDateTime::currentDateTime() to currentDateTimeUtc()
The latter is much faster as it doesn't have to deal with
time zones.

This change is safe because QNetworkHeadersPrivate::fromHttpDate(),
used as the QDateTime source in other, nearby, code paths, also
returns only UTC date-times. So not only is this change faster at
the call site, it also avoids inconsistent-timespec comparisons
down the line.

Credits to Milian Wolff, from whose QtWS15 talk this advice is
taken.

Change-Id: I26d308a2763cc45d28bc96871e651f30b17a6b85
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-01-04 12:58:41 +00:00
Marc Mutz
194e158beb QtCore: eradicate all Q_FOREACH loops [io]
Saves more than 1KiB in text size on optimized GCC 4.9 Linux
AMD64 builds.

Change-Id: I1a974e903bc8352af800fa26edae0194c1e51705
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-04 12:22:55 +00:00
Marc Mutz
5170c0416b QWindowsFileSystemWatcher: increase concurrency when canceling threads
The old code asked each thread to stop, and then waited for
that one thread to finish before deleting it and turning
to the next thread in line.

Split the three actions, ie. first ask all threads to stop,
then wait for all threads to finish, and only then delete
all of them.

Apart from being more icache-friendly, this enables more
concurrency, as stopped threads' cleanup work can overlap
with other's, thus reducing the wait() time per thread to
potentially zero.

Did not replicate the inefficient foreach loop, but went
with C++11 range-fors directly.

Change-Id: I53e598e31999a772c0f81ff5885490216e13d492
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-01-04 12:22:50 +00:00
Marc Mutz
90484f3901 QtCore: eradicate all Q_FOREACH loops [itemmodels]
Saves more than 4KiB in text size on optimized GCC 4.9 Linux
AMD64 builds.

Change-Id: Ice3fe915622a399d1ed10e0ce364cf54b4b835fe
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-04 12:22:45 +00:00
Marc Mutz
2d2d44a3d1 QtCore: eradicate all Q_FOREACH loops [statemachine]
Saves a bit over 2.5KiB in text size on optimized GCC 4.9 Linux
AMD64 builds.

Change-Id: I18a635d65a3c20c4bf5ec2cbfa4ed81a8153cab3
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-04 12:22:39 +00:00
Marc Mutz
8faf51429e QtCore: eradicate all Q_FOREACH loops [threads, plugins]
Saves just shy of 4KiB in text size on optimized GCC 4.9 Linux
AMD64 builds, iow: ~0.07% of the total QtCore library size.

Change-Id: I87fdcc8ee25c6bb5dabddb9a694ab4496b1538fa
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-01-04 12:22:34 +00:00
Marc Mutz
0ff221f522 QtCore: eradicate all Q_FOREACH loops [mimetypes]
Saves just shy of 6KiB in text size on optimized GCC 4.9 Linux
AMD64 builds, iow: ~0.1% of the total QtCore library size.

Change-Id: I087e1e34a64944affb1211e16371e314012c4b2c
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-04 12:22:29 +00:00
Marc Mutz
fd7861ac4b QtOpenGL: eradicate all remaining Q_FOREACH loops
Not many left. Still 344b saved in text size on optimized
GCC 4.9 Linux AMD64 builds.

Change-Id: I51ba49fe065854f84e26d25d7da5e26427ea2c0b
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2016-01-04 12:22:23 +00:00
Marc Mutz
41ca17fa97 QLineEdit: de-inline effective*TextMargin()
Saves 327b in text size, but done mainly because such
functions shouldn't be inline in the first place.

Change-Id: Ieea97f13620e4411dc01cb0d390bd668c13cfa7a
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-04 12:22:16 +00:00
Marc Mutz
264c72837d Add qAsConst
...to turn mutable lvalues into const lvalues.

Like the proposed std::as_const, it should not apply to
rvalues to avoid lifetime issues in code like

     for (auto x : qAsConst(someFunc()))
         // dangling

At a more basic level, qAsConst isn't useful for rvalues,
because one can always store them in an lvalue first, with
no loss in performance (the object is created by the
compiler silently anyway). So the correct way to write the
above is:

    const auto funcResult = someFunc();
    for (auto e : funcResult)

To fail compilation when passing rvalues, I used the
const-&& pattern also employed by std::cref(), and the
proposed std::as_const.

Intended as internal API, but not put into the QtPrivate
namespace to make it simpler to use.

We could wait for std::as_const, but that is far, far
away (just entered the current C++17 draft as of this
writing), and the Qt containers with their tendency to
detach are a problem _now_.

Change-Id: I8824a59d2274de5c5cd642f117212322e4648025
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-04 12:22:12 +00:00
Giuseppe D'Angelo
3880f41e68 Update PCRE to SVN r1622 (8.38 + patches)
In preparation for the 5.6 release.

Upstream changelog: http://vcs.pcre.org/pcre/code/trunk/ChangeLog?revision=1622&view=markup&pathrev=1622
Upstream changes: http://vcs.pcre.org/pcre/code/trunk/?pathrev=1622

Change-Id: I97fb23f6b42f4871f05daa726c2edfc691a16d8e
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-04 08:56:28 +00:00
Olivier Goffart
c7ab816af1 qmutex_unix: use a semaphore when available
It makes tst_QMutex::contendedQMutex with no msleep 8 times faster

Change-Id: Ic300e7618b4467e4e08b30f0213bd23c06d4d90a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-04 08:40:18 +00:00
Marc Mutz
e0c8316e17 QUrlQuery: remove misleading comment
The 'itemList' is a QList and is not maintained in sorted order.

Change-Id: I8f221281803ff0e9caa054007bee3058214f2f30
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-04 06:10:51 +00:00
Marc Mutz
b20de8a23d QTranslator: Extract Method is_readable_file from find_translation()
The old code re-used a QFileInfo object, repeatedly
setting new file names with QFileInfo::setFile(QString).

But QFileInfo::setFile() simply assigns itself a
new QFileInfo object:
    *this = QFileInfo(...)
so it's just as efficient to re-create a new QFIleInfo
object for every file name under test.

To avoid extra {} for object lifetime scoping, factor
the repeated evaluation of isReadable() && isFile()
into a small helper function, which also creates and
destroys the QFileInfo object.

The deeper significance of this change is that it
avoids implicit sharing of 'realname', which is
permanently modified. A later patch will make
changes that make 'realname' re-use its capacity
through the lifetime of the find_translation()
function, and sharing the variable implicitly will
nip any auch attempts in the bud.

Force the compiler to not inline the new function.
There's really no point in spending ~0.5KiB in text
size on inlining the code; the miniscule speed
improvement is dwarfed by the memory allocation of
the QFileInfo ctor, anyway.

As a consequence, this change even saves 96b in text
size on optimized GCC 4.9 Linux AMD64 builds, even
though that wasn't even the goal.

Change-Id: I08c5cbb7b6f1ba59440a1597e28d962ce63a7c65
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-04 06:10:45 +00:00
Thiago Macieira
b08d84d39e Autotest: Make sure that we can place calls with disabled delivery
This often happens in applications. Besides, we are expecting at least a
call to RequestName to happen.

Change-Id: Ifd2454ffba454fd591d0ffff1425a84563267d19
Reviewed-by: David Faure <david.faure@kdab.com>
2016-01-03 19:16:33 +00:00
Marc Mutz
5f542f3cca QDBusArgument: remove useless op<< overloads
... and remove misleading comments (these are overloads, not specializations).

The QList overloads do nothing different from the generic container
overloads. Remove them.

Only leave the QVariantList overload, because that converts to
QDBusVariant before serializing. Which means that this should
probably be templated on the container type, otherwise you get
different behavior for QList<QVariant> and, say, QVector<QVariant>,
which is surely wrong.

Change-Id: I215ba9891235b51304c2ed4041d3dbd003d69581
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-03 18:46:27 +00:00
Dmitry Shachnev
7e132066c1 QNativeSocketEngine: fix undefined variable on FreeBSD
Change-Id: I192e20eef4db27fc19ec9a6e517ae5c8cb88897c
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-01-02 14:56:15 +00:00
Marc Mutz
04e76ec857 QUnixPrintWidget: fix some poor uses of the QComboBox API
- populate the widget with addItems(QStringList) instead of
  looping over addItem(QString)
- Use findText() instead of looping over itemText(int).
  QComboBox::findText() delegates searching to the model
  (via QAbstractItemModel::match()), so is potentially
  much faster. I say potentially, because match() isn't
  properly reimplemented in most models, yet. But that is
  something to fix in the models.

Change-Id: I6e52cf5af810ab7869c0270504a241868a5ca281
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-01-02 10:44:23 +00:00
Thiago Macieira
0828d4e8ea Autotest: test both libdbus-1 load failure and connection failure
Change-Id: I39cc61d0d59846ab8c23ffff14242294649c1a45
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2016-01-02 02:06:10 +00:00
Thiago Macieira
9510d99f08 Autotest: Mark D-Bus tests that don't connect to the bus as parallel
There's no problem running them in parallel.

Change-Id: I39cc61d0d59846ab8c23ffff142420a127ab6968
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2016-01-02 02:05:52 +00:00
Thiago Macieira
1f6fa1f37a Suspend processing of some messages in the default busses by default
To retain a bit compatibility with applications developed in the last 9
years that expect that QDBusConnections won't process their events until
the event loop runs, we now suspend the handling of incoming messages
in the two default buses (and only in them) and resume when the event
loop starts. This is required because the new threaded QtDBus would
otherwise process incoming messages that the application didn't expect
it to.

For example, if the application first acquires names on the bus and only
after that registers objects with QtDBus, there's a small window in
which the name is acquired and visible to other applications, but no
objects are registered yet. Calls to those objects may be received,
would then be processed in the QDBusConnectionManager thread and fail.

The work around is to disable the actual handling of method calls and
signals in QDBusConnectionPrivate::handleMessage. Instead, those
messages are queued until later.

Due to the way that libdbus-1 works, outgoing method calls that are
waiting for replies are not affected, since their processing does not
happen in handleMessage().

[ChangeLog][Important Behavior Changes] QtDBus now uses threads to
implement processing of incoming and outgoing messages. This solves a
number of thread safety issues and fixes an architectural problem that
would cause all processing to stop if a particular thread (usually the
main thread) were blocked in any operation. On the flip side, application
developers need to know that modifications to a QDBusConnection may be
visible immediately on the connection, so they should be done in an
order that won't allow for incomplete states to be observed (for
example, first register all objects, then acquire service names).

Change-Id: I39cc61d0d59846ab8c23ffff1423c6d555f6ee0a
Reviewed-by: David Faure <david.faure@kdab.com>
2016-01-02 02:05:45 +00:00