ObjFW  Check-in [9882a09715]

Overview
Comment:OFSubprocess: Fix dealloc after -[closeForWriting]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | 1.0
Files: files | file ages | folders
SHA3-256: 9882a097159808d41c6ed178d992d4b4bac7b54247fe2370dcd1506f6314361b
User & Date: js on 2024-01-21 09:56:04
Other Links: branch diff | manifest | tags
Context
2024-01-21
10:39
OFSubprocess: Fix compilation on macOS check-in: 93c947c919 user: js tags: 1.0
09:56
OFSubprocess: Fix dealloc after -[closeForWriting] check-in: 9882a09715 user: js tags: 1.0
09:55
OFSubprocess: Fix dealloc after -[closeForWriting] check-in: 3f56716b3d user: js tags: trunk
09:39
OFSubprocess: Correctly handle nil environment check-in: c9125d25d4 user: js tags: 1.0
Changes

Modified src/platform/POSIX/OFSubprocess.m from [99bd20546d] to [bc4c8c1cd4].

373
374
375
376
377
378
379

380


381
382
383
384
385
386
387
373
374
375
376
377
378
379
380

381
382
383
384
385
386
387
388
389







+
-
+
+







}

- (void)close
{
	if (_readPipe[0] == -1)
		@throw [OFNotOpenException exceptionWithObject: self];

	if (_writePipe[1] != -1)
	[self closeForWriting];
		[self closeForWriting];

	close(_readPipe[0]);

	if (_pid != -1) {
		kill(_pid, SIGTERM);
		waitpid(_pid, &_status, WNOHANG);
	}

Modified src/platform/Windows/OFSubprocess.m from [a7d2548aa0] to [1709cb877d].

379
380
381
382
383
384
385

386


387
388
389
390
391
392
393
379
380
381
382
383
384
385
386

387
388
389
390
391
392
393
394
395







+
-
+
+







}

- (void)close
{
	if (_readPipe[0] == NULL)
		@throw [OFNotOpenException exceptionWithObject: self];

	if (_writePipe[1] != NULL)
	[self closeForWriting];
		[self closeForWriting];

	CloseHandle(_readPipe[0]);

	if (_handle != INVALID_HANDLE_VALUE) {
		TerminateProcess(_handle, 0);
		CloseHandle(_handle);
	}