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