Changeset 110699 in webkit
- Timestamp:
- Mar 14, 2012 8:02:14 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r110698 r110699 1 2012-03-14 Simon Hausmann <simon.hausmann@nokia.com> 2 3 [Qt] RunLoopQt is missing reentrancy guards 4 https://bugs.webkit.org/show_bug.cgi?id=80982 5 6 Reviewed by Tor Arne Vestbø. 7 8 Avoid recursive calls to RunLoop::performWork() with a simple 9 counting mechanism, to avoid out-of-order message dispatching. 10 11 * platform/qt/RunLoopQt.cpp: 12 (WebCore::RunLoop::TimerObject::TimerObject): 13 (WebCore::RunLoop::TimerObject::performWork): 14 (RunLoop::TimerObject): 15 1 16 2012-03-14 Ilya Tikhonovsky <loislo@chromium.org> 2 17 -
trunk/Source/WebCore/platform/qt/RunLoopQt.cpp
r105475 r110699 40 40 Q_OBJECT 41 41 public: 42 TimerObject(RunLoop* runLoop) : m_runLoop(runLoop) 42 TimerObject(RunLoop* runLoop) 43 : m_runLoop(runLoop) 44 , m_pendingPerformWorkInvocations(0) 43 45 { 44 46 int methodIndex = metaObject()->indexOfMethod("performWork()"); … … 46 48 } 47 49 48 Q_SLOT void performWork() { m_runLoop->performWork(); } 50 Q_SLOT void performWork() { 51 // It may happen that a secondary thread adds more method invocations via 52 // RunLoop::dispatch(), which will schedule a call to this function. If during 53 // performWork() event loop messages get processed, it may happen that this 54 // function is called again. In this case we should protected ourselves against 55 // recursive - and thus out-of-order - message dispatching and instead perform 56 // the work serially. 57 m_pendingPerformWorkInvocations++; 58 if (m_pendingPerformWorkInvocations > 1) 59 return; 60 61 while (m_pendingPerformWorkInvocations) { 62 m_runLoop->performWork(); 63 m_pendingPerformWorkInvocations--; 64 } 65 } 49 66 inline void wakeUp() { m_method.invoke(this, Qt::QueuedConnection); } 50 67 … … 58 75 RunLoop* m_runLoop; 59 76 QMetaMethod m_method; 77 int m_pendingPerformWorkInvocations; 60 78 }; 61 79
Note: See TracChangeset
for help on using the changeset viewer.