aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-02-04 15:35:11 +0000
committermarha <marha@users.sourceforge.net>2011-02-04 15:35:11 +0000
commit573e5c4f462c3f97697f16388025a8e13469487c (patch)
treeab48aa27b320ab28ca0b636770dc74f3e08b2ba2 /xorg-server/hw/xwin
parent81d327e65a2081a5bb48f974d9101ed9f85767a6 (diff)
downloadvcxsrv-573e5c4f462c3f97697f16388025a8e13469487c.tar.gz
vcxsrv-573e5c4f462c3f97697f16388025a8e13469487c.tar.bz2
vcxsrv-573e5c4f462c3f97697f16388025a8e13469487c.zip
Solved a crash in multiwindow mode due to a crash overflow:
- Make sure WM_WM_REINIT and WM_WM_MOVE do not have the same value - Make sure the nextview handle is not the same as the window itself
Diffstat (limited to 'xorg-server/hw/xwin')
-rw-r--r--xorg-server/hw/xwin/win.h2
-rw-r--r--xorg-server/hw/xwin/winclipboard.h2
-rw-r--r--xorg-server/hw/xwin/winclipboardinit.c7
-rw-r--r--xorg-server/hw/xwin/winclipboardwndproc.c27
-rw-r--r--xorg-server/hw/xwin/winwindow.h2
-rw-r--r--xorg-server/hw/xwin/winwndproc.c2
6 files changed, 34 insertions, 8 deletions
diff --git a/xorg-server/hw/xwin/win.h b/xorg-server/hw/xwin/win.h
index f24bc399a..df939b494 100644
--- a/xorg-server/hw/xwin/win.h
+++ b/xorg-server/hw/xwin/win.h
@@ -786,7 +786,7 @@ Bool
winInitClipboard (void);
void
-winFixClipboardChain (void);
+winFixClipboardChain (int Removed);
#endif
diff --git a/xorg-server/hw/xwin/winclipboard.h b/xorg-server/hw/xwin/winclipboard.h
index 9bf7c9c0e..95c4050a4 100644
--- a/xorg-server/hw/xwin/winclipboard.h
+++ b/xorg-server/hw/xwin/winclipboard.h
@@ -77,8 +77,6 @@ typedef int pid_t;
#define WIN_XEVENTS_CONVERT 2
#define WIN_XEVENTS_NOTIFY 3
-#define WM_WM_REINIT (WM_USER + 1)
-
#include "winmsg.h"
/*
diff --git a/xorg-server/hw/xwin/winclipboardinit.c b/xorg-server/hw/xwin/winclipboardinit.c
index 802b12fed..d5990900a 100644
--- a/xorg-server/hw/xwin/winclipboardinit.c
+++ b/xorg-server/hw/xwin/winclipboardinit.c
@@ -33,6 +33,9 @@
#endif
#include "dixstruct.h"
#include "winclipboard.h"
+#include "objbase.h"
+#include "ddraw.h"
+#include "winwindow.h"
/*
@@ -135,11 +138,11 @@ winClipboardCreateMessagingWindow (void)
}
void
-winFixClipboardChain (void)
+winFixClipboardChain (int Removed)
{
if (g_fClipboard
&& g_hwndClipboard)
{
- PostMessage (g_hwndClipboard, WM_WM_REINIT, 0, 0);
+ PostMessage (g_hwndClipboard, WM_WM_REINIT, Removed, 0);
}
}
diff --git a/xorg-server/hw/xwin/winclipboardwndproc.c b/xorg-server/hw/xwin/winclipboardwndproc.c
index dbfc61e4e..26a77ef74 100644
--- a/xorg-server/hw/xwin/winclipboardwndproc.c
+++ b/xorg-server/hw/xwin/winclipboardwndproc.c
@@ -38,6 +38,9 @@
#include "winclipboard.h"
#include "misc.h"
#include "winmsg.h"
+#include "objbase.h"
+#include "ddraw.h"
+#include "winwindow.h"
/*
* Constants
@@ -183,6 +186,14 @@ winClipboardWindowProc (HWND hwnd, UINT message,
/* Add ourselves to the clipboard viewer chain */
s_hwndNextViewer = SetClipboardViewer (hwnd);
+ #ifdef _DEBUG
+ if (s_hwndNextViewer== hwnd)
+ {
+ ErrorF("WM_CREATE: SetClipboardViewer returned own window. This causes an endless loop, so reset s_hwndNextViewer. ");
+ s_hwndNextViewer=NULL;
+ }
+ #endif
+
}
return 0;
@@ -196,6 +207,11 @@ winClipboardWindowProc (HWND hwnd, UINT message,
if ((HWND) wParam == s_hwndNextViewer)
{
s_hwndNextViewer = (HWND) lParam;
+ if (s_hwndNextViewer == hwnd)
+ {
+ winDebug("WM_CHANGECBCHAIN: trying to set s_hwndNextViewer to own window. Resetting it back to NULL. ");
+ s_hwndNextViewer=NULL; /* This would cause an endless loop, so break it by ending the loop here. I have seen this happening, why??? */
+ }
}
else if (s_hwndNextViewer)
SendMessage (s_hwndNextViewer, message,
@@ -231,9 +247,16 @@ winClipboardWindowProc (HWND hwnd, UINT message,
{
winDebug (" WM_WM_REINIT: Replacing us(%x) with %x at head "
"of chain\n", hwnd, s_hwndNextViewer);
- ChangeClipboardChain (hwnd, s_hwndNextViewer);
+ if (!wParam) ChangeClipboardChain (hwnd, s_hwndNextViewer); /* When wParam is set, the window was already removed from the chain */
winDebug (" WM_WM_REINIT: Putting us back at head of chain.\n");
s_hwndNextViewer = SetClipboardViewer (hwnd);
+ #ifdef _DEBUG
+ if (s_hwndNextViewer== hwnd)
+ {
+ ErrorF("WM_WM_REINIT: SetClipboardViewer returned own window. This causes an endless loop, so reset s_hwndNextViewer. ");
+ s_hwndNextViewer=NULL;
+ }
+ #endif
}
winDebug ("winClipboardWindowProc - WM_WM_REINIT: Exit\n");
}
@@ -277,7 +300,7 @@ winClipboardWindowProc (HWND hwnd, UINT message,
{
/* Attempt to break the nesting by getting out of the chain, twice?, and then fix and bail */
ChangeClipboardChain (hwnd, s_hwndNextViewer);
- winFixClipboardChain();
+ winFixClipboardChain(1);
ErrorF ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
"Nested calls detected. Re-initing.\n");
winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
diff --git a/xorg-server/hw/xwin/winwindow.h b/xorg-server/hw/xwin/winwindow.h
index 7c65ce505..8778fc696 100644
--- a/xorg-server/hw/xwin/winwindow.h
+++ b/xorg-server/hw/xwin/winwindow.h
@@ -116,6 +116,8 @@ typedef struct _winWMMessageRec{
#define WM_WM_MAP3 (WM_USER + 13)
#define WM_MANAGE (WM_USER + 100)
#define WM_UNMANAGE (WM_USER + 102)
+#define WM_WM_REINIT (WM_USER + 200)
+
#define MwmHintsDecorations (1L << 1)
diff --git a/xorg-server/hw/xwin/winwndproc.c b/xorg-server/hw/xwin/winwndproc.c
index aa158674e..5b2a866a9 100644
--- a/xorg-server/hw/xwin/winwndproc.c
+++ b/xorg-server/hw/xwin/winwndproc.c
@@ -1192,7 +1192,7 @@ winWindowProc (HWND hwnd, UINT message,
#ifdef XWIN_CLIPBOARD
/* Make sure the clipboard chain is ok. */
- winFixClipboardChain ();
+ winFixClipboardChain (0);
#endif
/* Call engine specific screen activation/deactivation function */