summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@petroules.com>2013-01-05 01:19:11 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-15 21:26:46 (GMT)
commitb744d9317153772d431e83aa306cea0faa0dc520 (patch)
treee05fadec65178038c3eb2fca79229a3c9e67926c /src
parentfbd769dea957d4ba548293d3b9db94350aafd77f (diff)
downloadQt-b744d9317153772d431e83aa306cea0faa0dc520.zip
Qt-b744d9317153772d431e83aa306cea0faa0dc520.tar.gz
Qt-b744d9317153772d431e83aa306cea0faa0dc520.tar.bz2
Use a UUID for the NSToolbar in unified title and toolbar.
When two NSToolbars in an application share the same identifier, Cocoa tries to synchronize their state (item position, view mode, etc.), and this behvavior interferes with and crashes Qt applications in certain cases when toggling the unified toolbar on and off. Therefore it is necessary to use a unique identifier for each native toolbar created. Does not affect Qt 5. This functionality has been removed and an equivalent will be provided by QtMacExtras which uses a completely different approach, though I7d5c8d58e45a504480a1ce67065add15cb35ad8f could be considered Qt 5's rough equivalent to this. Task-number: QTBUG-19207 Change-Id: I9030d56941d12a2c1f7a328337bf986f1b51eeb8 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/qmainwindowlayout_mac.mm3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm
index c2c90f0..a6b0a03 100644
--- a/src/gui/widgets/qmainwindowlayout_mac.mm
+++ b/src/gui/widgets/qmainwindowlayout_mac.mm
@@ -48,6 +48,7 @@
#ifndef QT_MAC_USE_COCOA
#include <Carbon/Carbon.h>
#else
+#include <quuid.h>
#include <private/qcocoatoolbardelegate_mac_p.h>
#import <private/qcocoawindowdelegate_mac_p.h>
#endif
@@ -444,7 +445,7 @@ void QMainWindowLayout::insertIntoMacToolbar(QToolBar *before, QToolBar *toolbar
QMacCocoaAutoReleasePool pool;
NSToolbar *macToolbar = [window toolbar];
if (macToolbar == nil) {
- macToolbar = [[NSToolbar alloc] initWithIdentifier:(NSString *)kQMainWindowMacToolbarID];
+ macToolbar = [[NSToolbar alloc] initWithIdentifier:qt_mac_QStringToNSString(QUuid::createUuid().toString())];
[macToolbar setDisplayMode:NSToolbarDisplayModeIconOnly];
[macToolbar setSizeMode:NSToolbarSizeModeRegular];
[macToolbar setDelegate:[[QT_MANGLE_NAMESPACE(QCocoaToolBarDelegate) alloc] initWithMainWindowLayout:this]];