this allows us to extend its dependencies, which we will make use of later.
Change-Id: I8809bdffb435455338e88e97049b10beeab0468a
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Windows accessibility can crash if it handles an event with an invalid
QAccessibleInterface pointer (one whose object has been deleted).
Task-number: QTBUG-41597
Change-Id: Iba099f7cb732fd00f18f04bd951c6cdd94785871
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
Say you have a document of two blocks of text.
When you select a block of text in the document and then replace this
with a new empty block (by pressing enter) and then subsequently
undo this action, the following three steps are performed as a
chain of undo commands:
1. Remove the empty block at the beginning of the document
2. Insert a new empty block at the beginning of the document
3. Insert the text back into the first block
Since a block is removed and inserted in the same go, both blocks
require a relayout, since the accumulated change spans both blocks.
However, in QPlainTextDocumentLayout we would only look at the max
of either removed chars or added chars. This would match the text
length of the first block at this point, so we would only relayout
that block. However, since we are also removing characters, the
actual accumulated change to the document is larger. We should
relayout any block touched by the sum of the added and removed
character counts.
Missing this, the paint event would later query
block.layout()->lineForTextPosition(0) which would give an invalid
line despite the fact that the block.length() > 0. This caused
a crash in the paint event when the full width selection was
turned on.
Note that the logic here was only recently updated to include the
removed characters at all in the logic, by the SHA1:
2983cb9531.
[ChangeLog][QPlainTextEdit] Fixed a crash when using full width
selections and issuing a complex undo command chain which removes
and inserts an empty block in one go.
Task-number: QTBUG-36415
Change-Id: Iafe8a69e455e0c713a48714f10f0cace69c84f51
Reviewed-by: Axel Rasmussen <axel.rasmussen1@gmail.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
So far, we were restricted by the values of ThemeButtonKind, which
consist mostly of buttons. We want to generalize to other kind of
controls when the time arrives. Already, QPushButton with pull-
down menu is not possible to get from that enum, while its easy to
get from NSPopupButton.
Task-number: QTBUG-40833
Change-Id: I244c42c42ab595f4790050eb15ade70443e155b2
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
This allows the menu to tell its containing item the menu got
deleted. This removes the need to reset the COCOA_MENU_ANCESTOR
property value, which would crash since QCocoaMenuItem::m_menu
would be a dangling pointer.
Task-number: QTBUG-41587
Change-Id: Ia3408ef85cf823bfddbc2c41d6534e43bf14ed29
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
MinGW static libs use libfoo.a format, and not foo.lib.
Change-Id: I899adca8ec0b1c8430f5b6c4f18ad0ea1dc6d398
Reviewed-by: Timothy Gu <timothygu99@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
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 <oswald.buddenhagen@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
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 <kamm@incasoftware.de>
Reviewed-by: Richard J. Moore <rich@kde.org>
Radio button, checkbox and non-editable combobox, in normal,
small and mini sizes, and only in the inactive state.
This commit amends 982b9b7ec2.
Task-number: QTBUG-40833
Change-Id: If3f2bb215e9b8966cbf15f08fa252feb92483c7b
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
-[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 <Timur.Pocheptsov@digia.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
This was done wrong when using the ini format.
Task-number: QTBUG-22461
Change-Id: Ib9390460bce6138659cceac7e3cd25339ba5e9bb
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
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 <thiago.macieira@intel.com>
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 <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
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 <gunnar@sletta.org>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
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 <marc.mutz@kdab.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
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 <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
An early return in case of errors leaked memory tracked in a variable
in scope.
Change-Id: I68cd77890608caff54df7476d38850e5541ce76e
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
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 <psychon@znc.in>
Reviewed-by: Gatis Paeglis <gatis.paeglis@digia.com>
An early return caused a leak of a new'd allocated object.
Change-Id: I9fbc37238dd49066d24363a2e8ee8bf35b155301
Reviewed-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
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 <morten.sorvig@digia.com>
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 <gabriel.dedietrich@digia.com>
A regression was introduced by bdebec4e2e.
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 <gabriel.dedietrich@digia.com>
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 <jorgen.lind@digia.com>
socket(2) is allowed to return 0, so 0 should not be included
when checking for errors.
Change-Id: I0454ea60347d90078d3ab3046969add8d5c37935
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Richard J. Moore <rich@kde.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
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 <lars.knoll@digia.com>
Reviewed-by: Richard J. Moore <rich@kde.org>
Some IMEs will perform an insertNewLine when Return/Enter is pressed while
composing text as well as causing the edit to finish. By handling this it
will ensure that the extra enter/return event is sent when the IME
requests it.
Task-id: QTBUG-39125
Change-Id: Ice6eded68e6b1dc51703a38316f76f78099923da
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
qatomic_sparc.h was removed previously as part of general cleanup of
old atomic code for Qt 5.3. Unfortunately SPARC include reference was
not removed resulting in build failure on that platform.
Task-number: QTBUG-41384
Change-Id: Ic6e31b32324b0e5dd3700a6a21515a8eea5668bd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Qt sets a QCocoaMenuDelegate on every menu it creates in order to emit
the (OSX specific) aboutToShow signal. However, there are a few cases
where OSX will copy a menu without copying the delegate. One of those
cases is the dock: the result of -[NSApplication applicationDockMenu:]
is used to create a new menu, to which a few more items are copied.
This copy is then send back to the dock.
This patch invokes the delegate's -menuWillOpen: method when
-[NSApplication applicationDockMenu:] is called. Note that sub-menus
won't receive the call-back, because the dock doesn't tell the
application what happens after returning from applicationDockMenu:.
Task-number: QTBUG-39604
Change-Id: I0e06df371a3d77342ae4b7148041214e5c4579d7
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
QToolButton::sizeHint() takes into account the presence of a menu.
However, setMenu() doesn't retrigger a size hint recalculation. Hence,
(un)setting a menu on an already sized tool button won't properly
reset the size hint. Since the calculated size hint is cached,
delete the cached value and call updateGeometry to cause a
recalculation.
Task-number: QTBUG-38949
Change-Id: I6e79e5e70e31afdfd129282b3668875eca86f51d
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
The code transformed the coordinates from the view to the window's
content view, and since that content view is flipped in the pure
Qt world (content view == QNSView), it manually flipped the
coordinates to transform from that to window coordinates.
Instead just directly transform the view coordinates to window
coordinates using standard Cocoa methods, which then works with
any kind of content view and NSWindow configuration.
Task-number: QTBUG-40958
Change-Id: Idddd327fe9cff3309606379d0e04ee8b4bd5eece
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
And not a normal pointer. The problem is that in certain scenarios,
if the TLW containing a QSizeGrip changes and the old TLW gets
immediately destroyed, then the mechanism which updates the tracked
TLW is run too late, and ends up accessing a dangling pointer.
Therefore, we need to protect that pointer via a smart pointer.
Task-number: QTBUG-22867
Change-Id: Icfb051132bacde604f660ac7a98bc0a9d1022c68
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
thread-local variables are known to be broken on Windows XP if the
library is loaded dynamically. This has been fixed since Windows Vista,
but to avoid any elaborate runtime checking of the OS version we're just
removing the logic alltogether for MSVC / Windows.
Task-number: QTBUG-41008
Change-Id: I64ee95270d142294c975a5890d6e1b62a833b6ef
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Added the notion that enter and return keys are not handled
if editor is of type QTextEdit or QPlainTextEdit.
Change-Id: I9d5cb529bf154c687fab1949fccf37e9da096c85
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Right now, we use them for inactive non-editable combo box, check
box, and radio button only on Yosemite. We keep as much as possible
the previous behavior on older versions.
In addition, we add a way for QQuickStyleItem to specify the window
the item is on. This is currently without effect, since we don't
seem to take the inactive window state into account.
Task-number: QTBUG-40833
Change-Id: I2fb2a99e6adf1972f881195b79b07ce85a960273
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>