Blame qt-everywhere-opensource-src-4.6.3-glib_eventloop_nullcheck.patch

Kevin Kofler 7497f5
diff -ur qt-everywhere-opensource-src-4.6.3/src/gui/kernel/qguieventdispatcher_glib.cpp qt-everywhere-opensource-src-4.6.3-glib_eventloop_nullcheck/src/gui/kernel/qguieventdispatcher_glib.cpp
Kevin Kofler 7497f5
--- qt-everywhere-opensource-src-4.6.3/src/gui/kernel/qguieventdispatcher_glib.cpp	2010-06-02 04:03:15.000000000 +0200
Kevin Kofler 7497f5
+++ qt-everywhere-opensource-src-4.6.3-glib_eventloop_nullcheck/src/gui/kernel/qguieventdispatcher_glib.cpp	2010-12-08 22:22:38.000000000 +0100
Kevin Kofler 7497f5
@@ -76,7 +76,7 @@
659f8c
     GX11EventSource *source = reinterpret_cast<GX11EventSource *>(s);
659f8c
     return (XEventsQueued(X11->display, QueuedAfterFlush)
659f8c
             || (!(source->flags & QEventLoop::ExcludeUserInputEvents)
659f8c
-                && !source->d->queuedUserInputEvents.isEmpty()));
659f8c
+                && source->d && !source->d->queuedUserInputEvents.isEmpty()));
659f8c
 }
0b3637
 
659f8c
 static gboolean x11EventSourceCheck(GSource *s)
Kevin Kofler 7497f5
@@ -84,7 +84,7 @@
53d9fc
     GX11EventSource *source = reinterpret_cast<GX11EventSource *>(s);
53d9fc
     return (XEventsQueued(X11->display, QueuedAfterFlush)
53d9fc
             || (!(source->flags & QEventLoop::ExcludeUserInputEvents)
53d9fc
-                && !source->d->queuedUserInputEvents.isEmpty()));
53d9fc
+                && source->d && !source->d->queuedUserInputEvents.isEmpty()));
53d9fc
 }
53d9fc
 
53d9fc
 static gboolean x11EventSourceDispatch(GSource *s, GSourceFunc callback, gpointer user_data)
Kevin Kofler 7497f5
@@ -95,7 +95,7 @@
Kevin Kofler 7497f5
     do {
Kevin Kofler 7497f5
         XEvent event;
Kevin Kofler 7497f5
         if (!(source->flags & QEventLoop::ExcludeUserInputEvents)
Kevin Kofler 7497f5
-            && !source->d->queuedUserInputEvents.isEmpty()) {
Kevin Kofler 7497f5
+            && source->d && !source->d->queuedUserInputEvents.isEmpty()) {
Kevin Kofler 7497f5
             // process a pending user input event
Kevin Kofler 7497f5
             event = source->d->queuedUserInputEvents.takeFirst();
Kevin Kofler 7497f5
         } else if (XEventsQueued(X11->display, QueuedAlready)) {
Kevin Kofler 7497f5
@@ -112,7 +112,8 @@
Kevin Kofler 7497f5
                 case XKeyRelease:
Kevin Kofler 7497f5
                 case EnterNotify:
Kevin Kofler 7497f5
                 case LeaveNotify:
Kevin Kofler 7497f5
-                    source->d->queuedUserInputEvents.append(event);
Kevin Kofler 7497f5
+                    if (source->d)
Kevin Kofler 7497f5
+                        source->d->queuedUserInputEvents.append(event);
Kevin Kofler 7497f5
                     continue;
Kevin Kofler 7497f5
 
Kevin Kofler 7497f5
                 case ClientMessage:
Kevin Kofler 7497f5
@@ -127,7 +128,8 @@
Kevin Kofler 7497f5
                             break;
Kevin Kofler 7497f5
                         }
Kevin Kofler 7497f5
                     }
Kevin Kofler 7497f5
-                    source->d->queuedUserInputEvents.append(event);
Kevin Kofler 7497f5
+                    if (source->d)
Kevin Kofler 7497f5
+                        source->d->queuedUserInputEvents.append(event);
Kevin Kofler 7497f5
                     continue;
Kevin Kofler 7497f5
 
Kevin Kofler 7497f5
                 default:
Kevin Kofler 7497f5
@@ -140,7 +142,7 @@
Kevin Kofler 7497f5
         }
Kevin Kofler 7497f5
 
Kevin Kofler 7497f5
         // send through event filter
Kevin Kofler 7497f5
-        if (source->q->filterEvent(&event))
Kevin Kofler 7497f5
+        if (source->q && source->q->filterEvent(&event))
Kevin Kofler 7497f5
             continue;
Kevin Kofler 7497f5
 
Kevin Kofler 7497f5
         if (qApp->x11ProcessEvent(&event) == 1)
Kevin Kofler 7497f5
@@ -152,7 +154,8 @@
Kevin Kofler 7497f5
 
Kevin Kofler 7497f5
  out:
Kevin Kofler 7497f5
 
Kevin Kofler 7497f5
-    source->d->runTimersOnceWithNormalPriority();
Kevin Kofler 7497f5
+    if (source->d)
Kevin Kofler 7497f5
+        source->d->runTimersOnceWithNormalPriority();
Kevin Kofler 7497f5
 
Kevin Kofler 7497f5
     if (callback)
Kevin Kofler 7497f5
         callback(user_data);