summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2010-05-26 11:28:42 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2010-05-26 11:28:42 (GMT)
commitf2d6af86383cfd9d5344673f4c755f06b900fa46 (patch)
treea00711f73c644f59523899627d309fd8665ca07c /src/corelib
parent70ae881499ec329e6fdf96d56a6189f77641b3b0 (diff)
parent39b861b75566c4db0db3b5aba2aa191a59f10bdb (diff)
downloadQt-f2d6af86383cfd9d5344673f4c755f06b900fa46.zip
Qt-f2d6af86383cfd9d5344673f4c755f06b900fa46.tar.gz
Qt-f2d6af86383cfd9d5344673f4c755f06b900fa46.tar.bz2
Merge branch '4.7' of scm.dev.troll.no:qt/qt into 4.7
Conflicts: src/gui/kernel/qapplication_s60.cpp
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/kernel/qabstractitemmodel.cpp10
-rw-r--r--src/corelib/kernel/qeventdispatcher_symbian.cpp46
-rw-r--r--src/corelib/kernel/qeventdispatcher_symbian_p.h20
3 files changed, 59 insertions, 17 deletions
diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp
index 3660a3c..24c26b6 100644
--- a/src/corelib/kernel/qabstractitemmodel.cpp
+++ b/src/corelib/kernel/qabstractitemmodel.cpp
@@ -2501,6 +2501,8 @@ bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int star
}
/*!
+ \since 4.6
+
Begins a row move operation.
When reimplementing a subclass, this method simplifies moving
@@ -2526,7 +2528,7 @@ bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int star
same, in which case you must ensure that the \a destinationChild is
not within the range of \a sourceFirst and \a sourceLast. You
must also ensure that you do not attempt to move a row to one of
- its own chilren or ancestors. This method returns false if either
+ its own children or ancestors. This method returns false if either
condition is true, in which case you should abort your move
operation.
@@ -2582,13 +2584,7 @@ bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int star
Note that other rows may be displaced accordingly.
\endtable
- \note This function emits the rowsAboutToBeInserted() signal which
- connected views (or proxies) must handle before the data is inserted.
- Otherwise, the views may end up in an invalid state.
-
\sa endMoveRows()
-
- \since 4.6
*/
bool QAbstractItemModel::beginMoveRows(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild)
{
diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp
index 33775d2..1cb8455 100644
--- a/src/corelib/kernel/qeventdispatcher_symbian.cpp
+++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp
@@ -100,25 +100,40 @@ static inline int qt_socket_select(int nfds, fd_set *readfds, fd_set *writefds,
class QSelectMutexGrabber
{
public:
- QSelectMutexGrabber(int fd, QMutex *mutex)
- : m_mutex(mutex)
+ QSelectMutexGrabber(int fd, QMutex *threadMutex, QMutex *selectCallMutex)
+ : m_threadMutex(threadMutex), m_selectCallMutex(selectCallMutex), bHasThreadLock(false)
{
- if (m_mutex->tryLock())
+ // see if selectThread is waiting m_waitCond
+ // if yes ... dont write to pipe
+ if (m_threadMutex->tryLock()) {
+ bHasThreadLock = true;
return;
+ }
+
+ // still check that SelectThread
+ // is in select call
+ if (m_selectCallMutex->tryLock()) {
+ m_selectCallMutex->unlock();
+ return;
+ }
char dummy = 0;
qt_pipe_write(fd, &dummy, 1);
- m_mutex->lock();
+ m_threadMutex->lock();
+ bHasThreadLock = true;
}
~QSelectMutexGrabber()
{
- m_mutex->unlock();
+ if(bHasThreadLock)
+ m_threadMutex->unlock();
}
private:
- QMutex *m_mutex;
+ QMutex *m_threadMutex;
+ QMutex *m_selectCallMutex;
+ bool bHasThreadLock;
};
/*
@@ -400,7 +415,12 @@ void QSelectThread::run()
int ret;
int savedSelectErrno;
- ret = qt_socket_select(maxfd, &readfds, &writefds, &exceptionfds, 0);
+ {
+ // helps fighting the race condition between
+ // selctthread and new socket requests (cancel, restart ...)
+ QMutexLocker locker(&m_selectCallMutex);
+ ret = qt_socket_select(maxfd, &readfds, &writefds, &exceptionfds, 0);
+ }
savedSelectErrno = errno;
char buffer;
@@ -495,7 +515,9 @@ void QSelectThread::requestSocketEvents ( QSocketNotifier *notifier, TRequestSta
start();
}
- QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex);
+ QMutexLocker locker(&m_grabberMutex);
+
+ QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex, &m_selectCallMutex);
Q_ASSERT(!m_AOStatuses.contains(notifier));
@@ -506,7 +528,9 @@ void QSelectThread::requestSocketEvents ( QSocketNotifier *notifier, TRequestSta
void QSelectThread::cancelSocketEvents ( QSocketNotifier *notifier )
{
- QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex);
+ QMutexLocker locker(&m_grabberMutex);
+
+ QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex, &m_selectCallMutex);
m_AOStatuses.remove(notifier);
@@ -515,7 +539,9 @@ void QSelectThread::cancelSocketEvents ( QSocketNotifier *notifier )
void QSelectThread::restart()
{
- QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex);
+ QMutexLocker locker(&m_grabberMutex);
+
+ QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex, &m_selectCallMutex);
m_waitCond.wakeAll();
}
diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h
index bc42753..211ded4 100644
--- a/src/corelib/kernel/qeventdispatcher_symbian_p.h
+++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h
@@ -211,6 +211,26 @@ private:
QMutex m_mutex;
QWaitCondition m_waitCond;
bool m_quit;
+
+ // to protect when several
+ // requests like:
+ // requestSocketEvents
+ // cancelSocketEvents
+ // kick in the same time
+ // all will fight for m_mutex
+ //
+ // TODO: fix more elegantely
+ //
+ QMutex m_grabberMutex;
+
+ // this one will tell
+ // if selectthread is
+ // really in select call
+ // and will prevent
+ // writing to pipe that
+ // causes later in locking
+ // of the thread in waitcond
+ QMutex m_selectCallMutex;
};
class Q_CORE_EXPORT CQtActiveScheduler : public CActiveScheduler