Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp	(revision 42317)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp	(revision 42318)
@@ -181,4 +181,9 @@
     QString strKey = makeExtraDataKeyPerMonitor(GUI_LastGuestSizeHintWasFullscreen);
     machine.SetExtraData(strKey, isFullscreenOrSeamless() ? "true" : "");
+}
+
+void UIMachineView::sltDesktopResized()
+{
+    setMaxGuestSize();
 }
 
@@ -494,4 +499,11 @@
 }
 
+void UIMachineView::prepareConnections()
+{
+    /* Desktop resolution change (e.g. monitor hotplug): */
+    connect(QApplication::desktop(), SIGNAL(resized(int)), this,
+            SLOT(sltDesktopResized()));
+}
+
 void UIMachineView::prepareConsoleConnections()
 {
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h	(revision 42317)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h	(revision 42318)
@@ -92,4 +92,7 @@
     void sltPerformGuestResize(const QSize &aSize = QSize());
 
+    /* Watch dog for desktop resizes: */
+    void sltDesktopResized();
+
     /* Console callback handlers: */
     virtual void sltMachineStateChanged();
@@ -112,4 +115,5 @@
     virtual void prepareCommon();
     virtual void prepareFilters();
+    virtual void prepareConnections();
     virtual void prepareConsoleConnections();
     virtual void loadMachineViewSettings();
@@ -139,9 +143,12 @@
     const QPixmap& pauseShot() const { return m_pauseShot; }
     /** Atomically store the maximum guest resolution which we currently wish
-     * to handle for @a maxGuestSize() to read. */
+     * to handle for @a maxGuestSize() to read.  Should be called if anything
+     * happens (e.g. a screen hotplug) which might cause the value to change.
+     * @sa m_u64MaxGuestSize. */
     void setMaxGuestSize();
     /** Atomically read the maximum guest resolution which we currently wish to
      * handle.  This may safely be called from another thread (called by
-     * UIFramebuffer on EMT). */
+     * UIFramebuffer on EMT).
+     * @sa m_u64MaxGuestSize. */
     QSize maxGuestSize();
     /** Retrieve the last non-fullscreen guest size hint (from extra data).
@@ -225,5 +232,11 @@
     QSize m_fixedMaxGuestSize;
     /** Maximum guest resolution which we wish to handle.  Must be accessed
-     * atomically. */
+     * atomically.
+     * @note The background for this variable is that we need this value to be
+     * available to the EMT thread, but it can only be calculated by the
+     * GUI, and GUI code can only safely be called on the GUI thread due to
+     * (at least) X11 threading issues.  So we calculate the value in advance,
+     * monitor things in case it changes and update it atomically when it does.
+     */
     /** @todo This should be private. */
     volatile uint64_t m_u64MaxGuestSize;
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.cpp	(revision 42317)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.cpp	(revision 42318)
@@ -68,4 +68,7 @@
     prepareFilters();
 
+    /* Prepare connections: */
+    prepareConnections();
+
     /* Prepare console connections: */
     prepareConsoleConnections();
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp	(revision 42317)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp	(revision 42318)
@@ -63,4 +63,7 @@
     /* Prepare event-filters: */
     prepareFilters();
+
+    /* Prepare connections: */
+    prepareConnections();
 
     /* Prepare console connections: */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp	(revision 42317)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp	(revision 42318)
@@ -68,4 +68,7 @@
     prepareFilters();
 
+    /* Prepare connections: */
+    prepareConnections();
+
     /* Prepare console connections: */
     prepareConsoleConnections();
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp	(revision 42317)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp	(revision 42318)
@@ -72,4 +72,7 @@
     prepareFilters();
 
+    /* Prepare connections: */
+    prepareConnections();
+
     /* Prepare console connections: */
     prepareConsoleConnections();
