improved filter_event patch (kde#275469)

This commit is contained in:
Rex Dieter 2012-01-10 07:36:58 -06:00
parent adc7c115dd
commit 42134b3653
2 changed files with 95 additions and 9 deletions

View File

@ -1,15 +1,98 @@
--- qt-opensource-4.8.0.old/src/gui/kernel/qapplication_x11.cpp 2011-12-16 03:22:33.918428374 -0500
+++ qt-opensource-4.8.0.new/src/gui/kernel/qapplication_x11.cpp 2011-12-27 06:39:22.852191952 -0500
@@ -4244,6 +4244,12 @@ bool QETWidget::translateMouseEvent(cons
+++ qt-opensource-4.8.0.new/src/gui/kernel/qapplication_x11.cpp 2012-01-07 18:18:40.258246384 -0500
@@ -4244,7 +4205,12 @@ bool QETWidget::translateMouseEvent(cons
&& (nextEvent.xclient.message_type == ATOM(_QT_SCROLL_DONE) ||
(nextEvent.xclient.message_type == ATOM(WM_PROTOCOLS) &&
(Atom)nextEvent.xclient.data.l[0] == ATOM(_NET_WM_SYNC_REQUEST))))) {
- qApp->x11ProcessEvent(&nextEvent);
+ // As we may run through a significant number of a large class of non-MotionNotify
+ // events here, without returning to the event loop, just before processing nextEvent,
+ // pass it through QAbstractEventDispatcher::filterEvent(). Note that this issue may
+ // exist elsewhere, wherever events are compressed in a similar manner.
+ if (QAbstractEventDispatcher::instance()->filterEvent(&nextEvent))
+ continue;
qApp->x11ProcessEvent(&nextEvent);
+ // events here, without returning to the event loop, first pass nextEvent to
+ // QAbstractEventDispatcher::filterEvent() to allow applications which override
+ // QAbstractEventDispatcher::filterEvent() to handle the event first.
+ if (!QAbstractEventDispatcher::instance()->filterEvent(&nextEvent))
+ qApp->x11ProcessEvent(&nextEvent);
continue;
} else if (nextEvent.type != MotionNotify ||
nextEvent.xmotion.window != event->xmotion.window ||
--- qt-opensource-4.8.0.old/src/gui/kernel/qclipboard_x11.cpp 2011-12-08 00:06:02.000000000 -0500
+++ qt-opensource-4.8.0.new/src/gui/kernel/qclipboard_x11.cpp 2012-01-07 18:30:35.298287639 -0500
@@ -573,7 +573,11 @@ bool QX11Data::clipboardWaitForEvent(Win
// process other clipboard events, since someone is probably requesting data from us
XEvent e;
- if (XCheckIfEvent(X11->display, &e, checkForClipboardEvents, 0))
+ // Some applications may override QAbstractEventDispatcher::filterEvent(), so
+ // pass event to QAbstractEventDispatcher::filterEvent() before processing in
+ // x11ProcessEvent().
+ if (XCheckIfEvent(X11->display, &e, checkForClipboardEvents, 0) &&
+ !QAbstractEventDispatcher::instance()->filterEvent(&e))
qApp->x11ProcessEvent(&e);
now.start();
--- qt-opensource-4.8.0.old/src/gui/kernel/qdnd_x11.cpp 2011-12-08 00:06:02.000000000 -0500
+++ qt-opensource-4.8.0.new/src/gui/kernel/qdnd_x11.cpp 2012-01-07 18:28:13.841279478 -0500
@@ -42,6 +42,7 @@
#include "qplatformdefs.h"
#include "qapplication.h"
+#include "qabstracteventdispatcher.h"
#ifndef QT_NO_DRAGANDDROP
@@ -1941,7 +1942,11 @@ Qt::DropAction QDragManager::drag(QDrag
timer.start();
do {
XEvent event;
- if (XCheckTypedEvent(X11->display, ClientMessage, &event))
+ // Some applications may override QAbstractEventDispatcher::filterEvent(), so
+ // pass event to QAbstractEventDispatcher::filterEvent() before processing in
+ // x11ProcessEvent().
+ if (XCheckTypedEvent(X11->display, ClientMessage, &event) &&
+ !QAbstractEventDispatcher::instance()->filterEvent(&event))
qApp->x11ProcessEvent(&event);
// sleep 50 ms, so we don't use up CPU cycles all the time.
--- qt-opensource-4.8.0.old/src/gui/kernel/qwidget_x11.cpp 2011-12-08 00:06:02.000000000 -0500
+++ qt-opensource-4.8.0.new/src/gui/kernel/qwidget_x11.cpp 2012-01-07 18:29:26.286283657 -0500
@@ -44,6 +44,7 @@
#include "qdesktopwidget.h"
#include "qapplication.h"
#include "qapplication_p.h"
+#include "qabstracteventdispatcher.h"
#include "qnamespace.h"
#include "qpainter.h"
#include "qbitmap.h"
@@ -376,17 +377,22 @@ void qt_x11_wait_for_window_manager(QWid
do {
if (XEventsQueued(X11->display, QueuedAlready)) {
XNextEvent(X11->display, &ev);
- qApp->x11ProcessEvent(&ev);
-
- switch (state) {
- case Initial:
- if (ev.type == MapNotify && ev.xany.window == winid)
- state = Mapped;
- break;
- case Mapped:
- if (ev.type == Expose && ev.xany.window == winid)
- return;
- break;
+ // Some applications may override QAbstractEventDispatcher::filterEvent(), so
+ // pass event to QAbstractEventDispatcher::filterEvent() before processing in
+ // x11ProcessEvent().
+ if (!QAbstractEventDispatcher::instance()->filterEvent(&ev)) {
+ qApp->x11ProcessEvent(&ev);
+
+ switch (state) {
+ case Initial:
+ if (ev.type == MapNotify && ev.xany.window == winid)
+ state = Mapped;
+ break;
+ case Mapped:
+ if (ev.type == Expose && ev.xany.window == winid)
+ return;
+ break;
+ }
}
} else {
if (!XEventsQueued(X11->display, QueuedAfterFlush))

View File

@ -11,7 +11,7 @@ Summary: Qt toolkit
Name: qt
Epoch: 1
Version: 4.8.0
Release: 6%{?dist}
Release: 7%{?dist}
# See LGPL_EXCEPTIONS.txt, LICENSE.GPL3, respectively, for exception details
License: (LGPLv2 with exceptions or GPLv3 with exceptions) and ASL 2.0 and BSD and FTL and MIT
@ -1064,6 +1064,9 @@ fi
%changelog
* Tue Jan 10 2012 Rex Dieter <rdieter@fedoraproject.org> 4.8.0-7
- improved filter_event patch (kde#275469)
* Mon Jan 09 2012 Than Ngo <than@redhat.com> - 4.8.0-6
- bz#772128, CVE-2011-3922, Stack-based buffer overflow in embedded harfbuzz code