Index: /trunk/src/VBox/Devices/Graphics/DevVGA.cpp
===================================================================
--- /trunk/src/VBox/Devices/Graphics/DevVGA.cpp	(revision 49602)
+++ /trunk/src/VBox/Devices/Graphics/DevVGA.cpp	(revision 49603)
@@ -1834,12 +1834,14 @@
                 fgcol = palette[cattr & 0x0f];
                 if (cw != 9) {
-                    vga_draw_glyph8(d1, linesize,
-                                    font_ptr, cheight, fgcol, bgcol, dscan);
+                    if (pThis->fRenderVRAM)
+                        vga_draw_glyph8(d1, linesize,
+                                        font_ptr, cheight, fgcol, bgcol, dscan);
                 } else {
                     dup9 = 0;
                     if (ch >= 0xb0 && ch <= 0xdf && (pThis->ar[0x10] & 0x04))
                         dup9 = 1;
-                    vga_draw_glyph9(d1, linesize,
-                                    font_ptr, cheight, fgcol, bgcol, dup9);
+                    if (pThis->fRenderVRAM)
+                        vga_draw_glyph9(d1, linesize,
+                                        font_ptr, cheight, fgcol, bgcol, dup9);
                 }
                 if (src == cursor_ptr &&
@@ -1856,9 +1858,11 @@
                         d = d1 + (linesize * line_start << dscan);
                         if (cw != 9) {
-                            vga_draw_glyph8(d, linesize,
-                                            cursor_glyph, h, fgcol, bgcol, dscan);
+                            if (pThis->fRenderVRAM)
+                                vga_draw_glyph8(d, linesize,
+                                                cursor_glyph, h, fgcol, bgcol, dscan);
                         } else {
-                            vga_draw_glyph9(d, linesize,
-                                            cursor_glyph, h, fgcol, bgcol, 1);
+                            if (pThis->fRenderVRAM)
+                                vga_draw_glyph9(d, linesize,
+                                                cursor_glyph, h, fgcol, bgcol, 1);
                         }
                     }
@@ -4946,5 +4950,10 @@
     LogFlow(("vgaPortSetRenderVRAM: fRender = %d\n", fRender));
 
+    int rc = PDMCritSectEnter(&pThis->CritSect, VERR_SEM_BUSY);
+    AssertRC(rc);
+
     pThis->fRenderVRAM = fRender;
+
+    PDMCritSectLeave(&pThis->CritSect);
 }
 
Index: /trunk/src/VBox/Main/src-client/DisplayImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/DisplayImpl.cpp	(revision 49602)
+++ /trunk/src/VBox/Main/src-client/DisplayImpl.cpp	(revision 49603)
@@ -679,10 +679,13 @@
     }
 
-    mLastAddress = pvVRAM;
-    mLastBytesPerLine = cbLine;
-    mLastBitsPerPixel = bpp;
-    mLastWidth = w;
-    mLastHeight = h;
-    mLastFlags = flags;
+    if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN)
+    {
+        mLastAddress = pvVRAM;
+        mLastBytesPerLine = cbLine;
+        mLastBitsPerPixel = bpp;
+        mLastWidth = w;
+        mLastHeight = h;
+        mLastFlags = flags;
+    }
 
     ULONG pixelFormat;
@@ -729,4 +732,8 @@
         return VINF_VGA_RESIZE_IN_PROGRESS;
     }
+
+    /* Framebuffer will be invalid during resize, make sure that it is not accessed. */
+    if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN)
+        mpDrv->pUpPort->pfnSetRenderVRAM (mpDrv->pUpPort, false);
 
     int rc = callFramebufferResize (maFramebuffers[uScreenId].pFramebuffer, uScreenId,
@@ -794,4 +801,10 @@
         }
 
+        /* Inform VRDP server about the change of display parameters.
+         * Must be done before calling NotifyUpdate below.
+         */
+        LogRelFlowFunc(("Calling VRDP\n"));
+        mParent->consoleVRDPServer()->SendResize();
+
         /* @todo Merge these two 'if's within one 'if (!pFBInfo->pFramebuffer.isNull())' */
         if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN && !pFBInfo->pFramebuffer.isNull())
@@ -864,8 +877,4 @@
         }
 #endif /* DEBUG_sunlover */
-
-        /* Inform VRDP server about the change of display parameters. */
-        LogRelFlowFunc(("Calling VRDP\n"));
-        mParent->consoleVRDPServer()->SendResize();
 
 #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
