1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-06 22:04:12 +01:00

fix for a possible crash in some circumstances, caused by an illegal mem

acccess.
This commit is contained in:
dan
2000-04-19 14:54:34 +00:00
parent f3ed042f0c
commit 5852c7506f

View File

@@ -165,6 +165,7 @@ inputHandler(int fd, int mask, void *clientData) /*FOLD00*/
if ((mask & WIWriteMask)) { if ((mask & WIWriteMask)) {
if (cPtr->state == WCInProgress) { if (cPtr->state == WCInProgress) {
Bool failed;
int result; int result;
int len = sizeof(result); int len = sizeof(result);
@@ -172,9 +173,11 @@ inputHandler(int fd, int mask, void *clientData) /*FOLD00*/
(void*)&result, &len) == 0 && result != 0) { (void*)&result, &len) == 0 && result != 0) {
cPtr->state = WCFailed; cPtr->state = WCFailed;
WCErrorCode = result; WCErrorCode = result;
failed = True;
/* should call wsyserrorwithcode(result, ...) here? */ /* should call wsyserrorwithcode(result, ...) here? */
} else { } else {
cPtr->state = WCConnected; cPtr->state = WCConnected;
failed = False;
} }
if (cPtr->handler.write) { if (cPtr->handler.write) {
@@ -182,10 +185,12 @@ inputHandler(int fd, int mask, void *clientData) /*FOLD00*/
cPtr->handler.write = NULL; cPtr->handler.write = NULL;
} }
/* if the connection failed it may get destroyed in the delegate */
if (cPtr->delegate && cPtr->delegate->didInitialize) if (cPtr->delegate && cPtr->delegate->didInitialize)
(*cPtr->delegate->didInitialize)(cPtr->delegate, cPtr); (*cPtr->delegate->didInitialize)(cPtr->delegate, cPtr);
if (cPtr->state == WCFailed) /* don't access cPtr since it may have been destroyed by delegate */
if (failed)
return; return;
} else if (cPtr->state == WCConnected) { } else if (cPtr->state == WCConnected) {
WMFlushConnection(cPtr); WMFlushConnection(cPtr);