Browse Source

[Bugfix] Defer all format changes till requested framebuffer updates are

received. Viewer can crash otherwise. Thanks to Jan Gorig for the patch. 


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4004 3789f03b-4d11-0410-bbf8-ca57d06f2519
tags/v1.0.90
Adam Tkac 14 years ago
parent
commit
12c0fc399e
2 changed files with 17 additions and 5 deletions
  1. 16
    5
      unix/vncviewer/CConn.cxx
  2. 1
    0
      unix/vncviewer/CConn.h

+ 16
- 5
unix/vncviewer/CConn.cxx View File

#include <rfb/Password.h> #include <rfb/Password.h>
#include <rfb/screenTypes.h> #include <rfb/screenTypes.h>
#include <network/TcpSocket.h> #include <network/TcpSocket.h>
#include <cassert>


#include "TXViewport.h" #include "TXViewport.h"
#include "DesktopWindow.h" #include "DesktopWindow.h"
encodingChange(false), sameMachine(false), fullScreen(::fullScreen), encodingChange(false), sameMachine(false), fullScreen(::fullScreen),
ctrlDown(false), altDown(false), ctrlDown(false), altDown(false),
menuKeysym(0), menu(dpy, this), options(dpy, this), about(dpy), info(dpy), menuKeysym(0), menu(dpy, this), options(dpy, this), about(dpy), info(dpy),
reverseConnection(reverse), firstUpdate(true)
reverseConnection(reverse), firstUpdate(true), pendingUpdate(false)
{ {
CharArray menuKeyStr(menuKey.getData()); CharArray menuKeyStr(menuKey.getData());
menuKeysym = XStringToKeysym(menuKeyStr.buf); menuKeysym = XStringToKeysym(menuKeyStr.buf);
// one. We cannot do this if we're in the middle of a format change // one. We cannot do this if we're in the middle of a format change
// though. // though.
void CConn::framebufferUpdateStart() { void CConn::framebufferUpdateStart() {
if (!formatChange)
if (!formatChange) {
pendingUpdate = true;
requestNewUpdate(); requestNewUpdate();
} else
pendingUpdate = false;
} }


// framebufferUpdateEnd() is called at the end of an update. // framebufferUpdateEnd() is called at the end of an update.


// A format change prevented us from sending this before the update, // A format change prevented us from sending this before the update,
// so make sure to send it now. // so make sure to send it now.
if (formatChange)
if (formatChange && !pendingUpdate)
requestNewUpdate(); requestNewUpdate();


// Compute new settings based on updated bandwidth values // Compute new settings based on updated bandwidth values
break; break;
case ID_REFRESH: case ID_REFRESH:
menu.unmap(); menu.unmap();
writer()->writeFramebufferUpdateRequest(Rect(0, 0, cp.width, cp.height),
false);
if (!formatChange) {
writer()->writeFramebufferUpdateRequest(Rect(0, 0, cp.width, cp.height),
false);
pendingUpdate = true;
}
break; break;
case ID_F8: case ID_F8:
menu.unmap(); menu.unmap();
void CConn::requestNewUpdate() void CConn::requestNewUpdate()
{ {
if (formatChange) { if (formatChange) {

/* Catch incorrect requestNewUpdate calls */
assert(pendingUpdate == false);

if (fullColour) { if (fullColour) {
desktop->setPF(fullColourPF); desktop->setPF(fullColourPF);
} else { } else {

+ 1
- 0
unix/vncviewer/CConn.h View File

InfoDialog info; InfoDialog info;
bool reverseConnection; bool reverseConnection;
bool firstUpdate; bool firstUpdate;
bool pendingUpdate;
}; };


#endif #endif

Loading…
Cancel
Save