From ca7a80a29000f45fc1bd5b0c491abc2bc44b620f Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Tue, 1 Dec 2009 10:12:31 +0100 Subject: Fix a crash in QFSFileEnginePrivate::canonicalized() on Mac OS X 10.5 The realpath() extension we use in this function is only available from 10.6 onwards. For the time being this optimization is turned off on Mac. Reviewed-by: Markus Goetz --- src/corelib/io/qfsfileengine.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index b8f6e2c..2178fa9 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -138,12 +138,13 @@ QString QFSFileEnginePrivate::canonicalized(const QString &path) if (path.isEmpty()) return path; -#if defined(Q_OS_UNIX) || defined(Q_OS_SYMBIAN) // FIXME let's see if this stuff works, then we might be able to remove some of the other code. - // baaad Mac: 10.5 and 10.6 crash if trying to free a value returned by - // realpath() if the input path is just the root component. +#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) if (path.size() == 1 && path.at(0) == QLatin1Char('/')) return path; +#endif + // Mac OS X 10.5.x doesn't support the realpath(X,0) extenstion we use here. +#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) char *ret = realpath(path.toLocal8Bit().constData(), (char*)0); if (ret) { QString canonicalPath = QDir::cleanPath(QString::fromLocal8Bit(ret)); -- cgit v0.12 From 448bd8a0b69eab922df956bb0fbdb94abeb5c7ea Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Tue, 1 Dec 2009 10:46:43 +0100 Subject: Re-enabled realpath() on symbian. That was disabled by accident when we were disabling it for Mac. Reviewed-by: Prasanth --- src/corelib/io/qfsfileengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index 2178fa9..37b0ea1 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -144,7 +144,7 @@ QString QFSFileEnginePrivate::canonicalized(const QString &path) return path; #endif // Mac OS X 10.5.x doesn't support the realpath(X,0) extenstion we use here. -#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) +#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) || defined(Q_OS_SYMBIAN) char *ret = realpath(path.toLocal8Bit().constData(), (char*)0); if (ret) { QString canonicalPath = QDir::cleanPath(QString::fromLocal8Bit(ret)); -- cgit v0.12 From 6c8d6127d29266310ee797a19f3388ca7daadd92 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Tue, 1 Dec 2009 10:54:23 +0100 Subject: Make sure file descriptors are valid in the dnotify implementation of QFileSystemWatcher Commit 71c3227ba260b964b0c9516f05ad4f2e6fa72f69 fixed a memory leak by calling closedir(), which would also close the file descriptor we were wanting to watch. Fix this by duplicating the file descriptor that we store. Reviewed-by: TrustMe --- src/corelib/io/qfilesystemwatcher_dnotify.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qfilesystemwatcher_dnotify.cpp b/src/corelib/io/qfilesystemwatcher_dnotify.cpp index 03172e5..1fab010 100644 --- a/src/corelib/io/qfilesystemwatcher_dnotify.cpp +++ b/src/corelib/io/qfilesystemwatcher_dnotify.cpp @@ -269,8 +269,8 @@ QStringList QDnotifyFileSystemWatcherEngine::addPaths(const QStringList &paths, } } - fd = ::dirfd(d); - int parentFd = parent?::dirfd(parent):0; + fd = qt_safe_dup(::dirfd(d)); + int parentFd = parent ? qt_safe_dup(::dirfd(parent)) : 0; Q_ASSERT(fd); if(::fcntl(fd, F_SETSIG, SIGIO) || -- cgit v0.12 From b405b59dca7c3340ce424313c8e538dacbc2e824 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Tue, 1 Dec 2009 13:11:51 +0100 Subject: Fix regression in tst_QFileSystemWatcher Dnotify doesn't work on dup'ed file descriptors apparently, so we need to closedir() before using fcntl() to set the watches. Reviewed-by: TrustMe --- src/corelib/io/qfilesystemwatcher_dnotify.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/corelib/io/qfilesystemwatcher_dnotify.cpp b/src/corelib/io/qfilesystemwatcher_dnotify.cpp index 1fab010..c70232c 100644 --- a/src/corelib/io/qfilesystemwatcher_dnotify.cpp +++ b/src/corelib/io/qfilesystemwatcher_dnotify.cpp @@ -272,6 +272,9 @@ QStringList QDnotifyFileSystemWatcherEngine::addPaths(const QStringList &paths, fd = qt_safe_dup(::dirfd(d)); int parentFd = parent ? qt_safe_dup(::dirfd(parent)) : 0; + ::closedir(d); + if(parent) ::closedir(parent); + Q_ASSERT(fd); if(::fcntl(fd, F_SETSIG, SIGIO) || ::fcntl(fd, F_NOTIFY, DN_MODIFY | DN_CREATE | DN_DELETE | @@ -279,10 +282,6 @@ QStringList QDnotifyFileSystemWatcherEngine::addPaths(const QStringList &paths, (parent && ::fcntl(parentFd, F_SETSIG, SIGIO)) || (parent && ::fcntl(parentFd, F_NOTIFY, DN_DELETE | DN_RENAME | DN_MULTISHOT))) { - - ::closedir(d); - if(parent) ::closedir(parent); - continue; // Could not set appropriate flags } @@ -295,9 +294,6 @@ QStringList QDnotifyFileSystemWatcherEngine::addPaths(const QStringList &paths, pathToFD.insert(path, fd); if(parentFd) parentToFD.insert(parentFd, fd); - - ::closedir(d); - if(parent) ::closedir(parent); } Directory &directory = fdToDirectory[fd]; -- cgit v0.12 From 271936b063fb261293e3f77f7a2273e3a4dbb5d6 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Tue, 1 Dec 2009 14:54:40 +0100 Subject: Creator crashes when reloading externally modified .ui files on Mac On Mac QWidget::destroy() sends an AcceptDropsChange event after clearing the guards for QPointer. This was used to store a QPointer to the widget being deleted & that will never be cleared. The fix removed the setAcceptDrops() from destroy. And as an extra protection make sure designer will not treat that event as interesting. Task-number: QTCREATORBUG-307 Reviewed-by: Denis Dzyubenko Reviewed-by: Friedemann Kleint --- src/gui/kernel/qwidget_mac.mm | 2 -- tools/designer/src/components/formeditor/formwindowmanager.cpp | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 0d9f9ee..1907cca 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2617,8 +2617,6 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) releaseMouse(); if(mac_keyboard_grabber == this) releaseKeyboard(); - if(acceptDrops()) - setAcceptDrops(false); if(testAttribute(Qt::WA_ShowModal)) // just be sure we leave modal QApplicationPrivate::leaveModal(this); diff --git a/tools/designer/src/components/formeditor/formwindowmanager.cpp b/tools/designer/src/components/formeditor/formwindowmanager.cpp index 23d8580..246c56f 100644 --- a/tools/designer/src/components/formeditor/formwindowmanager.cpp +++ b/tools/designer/src/components/formeditor/formwindowmanager.cpp @@ -196,6 +196,7 @@ bool FormWindowManager::eventFilter(QObject *o, QEvent *e) case QEvent::HoverEnter: case QEvent::HoverLeave: case QEvent::HoverMove: + case QEvent::AcceptDropsChange: return false; default: break; -- cgit v0.12