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

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