Bug 65146. Fix deadlock potential in proxy code; remove unncessary locks from nsPipe2. r=darin,dougt; sr=brendan

This commit is contained in:
waterson%netscape.com 2001-02-12 23:33:11 +00:00
Родитель e9e8709445
Коммит 87a35f2e41
2 изменённых файлов: 6 добавлений и 4 удалений

Просмотреть файл

@ -399,7 +399,9 @@ nsPipe::nsPipeInputStream::ReadSegments(nsWriteSegmentFun writer,
readBufferLen = PR_MIN(readBufferLen, amt);
while (readBufferLen > 0) {
PRUint32 writeCount = 0;
mon.Exit(); // XXX avoid deadlock better
rv = writer(this, closure, readBuffer, *readCount, readBufferLen, &writeCount);
mon.Enter();
if (NS_FAILED(rv) && rv != NS_BASE_STREAM_WOULD_BLOCK)
goto done;
NS_ASSERTION(writeCount <= readBufferLen, "writer returned bad writeCount");
@ -690,7 +692,9 @@ nsPipe::nsPipeOutputStream::WriteSegments(nsReadSegmentFun reader,
writeBufLen = PR_MIN(writeBufLen, amt);
while (writeBufLen > 0) {
PRUint32 readCount = 0;
mon.Exit(); // XXX avoid deadlock better
rv = reader(this, closure, writeBuf, *writeCount, writeBufLen, &readCount);
mon.Enter();
if (rv == NS_BASE_STREAM_WOULD_BLOCK) {
NS_ASSERTION(readCount <= writeBufLen, "reader returned bad readCount");
// XXX should not update counters if reader returned WOULD_BLOCK!!

Просмотреть файл

@ -296,10 +296,7 @@ nsProxyObject::Release(void)
ProxyDestructorEventHandler,
ProxyDestructorDestroyHandler);
// fire it off.
mDestQueue->PostSynchronousEvent(event, nsnull);
PR_DELETE(event);
mDestQueue->PostEvent(event);
return 0;
}
return mRefCnt;
@ -540,5 +537,6 @@ static void* ProxyDestructorEventHandler(PLEvent *self)
static void ProxyDestructorDestroyHandler(PLEvent *self)
{
PR_DELETE(self);
}