]> git.pld-linux.org Git - packages/qt4.git/blob - qtcore-4.8.5-honor-ExcludeSocketNotifiers-in-glib-event-loop.patch
- up to 4.8.7; bunch of SECURITY fixes
[packages/qt4.git] / qtcore-4.8.5-honor-ExcludeSocketNotifiers-in-glib-event-loop.patch
1 From 267feb2de49eed0823ca0c29f1cd5238537c7116 Mon Sep 17 00:00:00 2001
2 From: Jan-Marek Glogowski <glogow@fbihome.de>
3 Date: Thu, 6 Mar 2014 18:44:43 +0100
4 Subject: Honor ExcludeSocketNotifiers in glib event loop
5
6 Implements QEventLoop::ExcludeSocketNotifiers in the same way
7 QEventLoop::X11ExcludeTimers is already implemented for the glib
8 event loop.
9
10 This prevents crashes when QClipboard checks for clipboard events
11 and
12   qApp->clipboard()->setProperty( "useEventLoopWhenWaiting", true );
13 is set.
14
15 Task-number: QTBUG-34614
16 Task-number: QTBUG-37380
17
18 Change-Id: Id4e2a74c6bdf8c3b439a4e3813d24d11368b607d
19 ---
20  src/corelib/kernel/qeventdispatcher_glib.cpp | 10 ++++++++++
21  1 file changed, 10 insertions(+)
22
23 diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp
24 index 0b0e308..ba522fa 100644
25 --- a/src/corelib/kernel/qeventdispatcher_glib.cpp
26 +++ b/src/corelib/kernel/qeventdispatcher_glib.cpp
27 @@ -65,6 +65,7 @@ struct GPollFDWithQSocketNotifier
28  struct GSocketNotifierSource
29  {
30      GSource source;
31 +    QEventLoop::ProcessEventsFlags processEventsFlags;
32      QList<GPollFDWithQSocketNotifier *> pollfds;
33  };
34  
35 @@ -80,6 +81,9 @@ static gboolean socketNotifierSourceCheck(GSource *source)
36      GSocketNotifierSource *src = reinterpret_cast<GSocketNotifierSource *>(source);
37  
38      bool pending = false;
39 +    if (src->processEventsFlags & QEventLoop::ExcludeSocketNotifiers)
40 +        return pending;
41 +
42      for (int i = 0; !pending && i < src->pollfds.count(); ++i) {
43          GPollFDWithQSocketNotifier *p = src->pollfds.at(i);
44  
45 @@ -103,6 +107,9 @@ static gboolean socketNotifierSourceDispatch(GSource *source, GSourceFunc, gpoin
46      QEvent event(QEvent::SockAct);
47  
48      GSocketNotifierSource *src = reinterpret_cast<GSocketNotifierSource *>(source);
49 +    if (src->processEventsFlags & QEventLoop::ExcludeSocketNotifiers)
50 +        return true;
51 +
52      for (int i = 0; i < src->pollfds.count(); ++i) {
53          GPollFDWithQSocketNotifier *p = src->pollfds.at(i);
54  
55 @@ -331,6 +338,7 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context)
56          reinterpret_cast<GSocketNotifierSource *>(g_source_new(&socketNotifierSourceFuncs,
57                                                                 sizeof(GSocketNotifierSource)));
58      (void) new (&socketNotifierSource->pollfds) QList<GPollFDWithQSocketNotifier *>();
59 +    socketNotifierSource->processEventsFlags = QEventLoop::AllEvents;
60      g_source_set_can_recurse(&socketNotifierSource->source, true);
61      g_source_attach(&socketNotifierSource->source, mainContext);
62  
63 @@ -416,6 +424,7 @@ bool QEventDispatcherGlib::processEvents(QEventLoop::ProcessEventsFlags flags)
64      // tell postEventSourcePrepare() and timerSource about any new flags
65      QEventLoop::ProcessEventsFlags savedFlags = d->timerSource->processEventsFlags;
66      d->timerSource->processEventsFlags = flags;
67 +    d->socketNotifierSource->processEventsFlags = flags;
68  
69      if (!(flags & QEventLoop::EventLoopExec)) {
70          // force timers to be sent at normal priority
71 @@ -427,6 +436,7 @@ bool QEventDispatcherGlib::processEvents(QEventLoop::ProcessEventsFlags flags)
72          result = g_main_context_iteration(d->mainContext, canWait);
73  
74      d->timerSource->processEventsFlags = savedFlags;
75 +    d->socketNotifierSource->processEventsFlags = savedFlags;
76  
77      if (canWait)
78          emit awake();
79 -- 
80 2.0.0
81
This page took 0.035192 seconds and 3 git commands to generate.