The Shell destructor was never called. Calling it showed that

the PtyReader thread in TermParse hanged in read(). There's even a 
comment in there (by Axel) that read() is never interrupted. Switched to 
kill_thread() in TermParse::StopPtyReader() until this problem is fixed. 
At least we don't leave running apps around anymore. :)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21997 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2007-08-17 09:54:32 +00:00
parent 22e16ac590
commit f3342f281b
3 changed files with 10 additions and 31 deletions

View File

@ -31,7 +31,6 @@
#include <time.h>
#include <unistd.h>
#define MAXPTTYS 16 * 4
#ifndef CEOF
#define CEOF ('D'&037)
@ -55,29 +54,6 @@
#define CSWTCH 0
#endif
/*
* ANSI emulation.
*/
#define INQ 0x05
#define FF 0x0C /* C0, C1 control names */
#define LS1 0x0E
#define LS0 0x0F
#define CAN 0x18
#define SUB 0x1A
#define ESC 0x1B
#define US 0x1F
#define DEL 0x7F
#define HTS ('H'+0x40)
#define SS2 0x8E
#define SS3 0x8F
#define DCS 0x90
#define OLDID 0x9A /* ESC Z */
#define CSI 0x9B
#define ST 0x9C
#define OSC 0x9D
#define PM 0x9E
#define APC 0x9F
#define RDEL 0xFF
/* default shell command and options. */
const char *kDefaultShellCommand = { "/bin/sh" "-login" };
@ -460,7 +436,7 @@ Shell::_Spawn(int row, int col, const char *encoding, int argc, const char **arg
/*
* set terminal interface.
*/
if (tcsetattr (0, TCSANOW, &tio) == -1) {
if (tcsetattr(0, TCSANOW, &tio) == -1) {
handshake.status = PTY_NG;
snprintf(handshake.msg, sizeof(handshake.msg),
"failed set terminal interface (TERMIOS).");
@ -506,7 +482,6 @@ Shell::_Spawn(int row, int col, const char *encoding, int argc, const char **arg
setenv("TTYPE", encoding, true);
setenv("SHELL", *argv, true);
execve(*argv, (char * const *)argv, environ);
/*

View File

@ -102,9 +102,6 @@ TermParse::StopThreads()
fQuitting = true;
//suspend_thread(fReaderThread);
// TODO: interrupt read() - doesn't work for whatever reason
StopPtyReader();
StopTermParse();
@ -229,7 +226,11 @@ TermParse::StopPtyReader()
if (fReaderThread >= 0) {
status_t dummy;
wait_for_thread(fReaderThread, &dummy);
//suspend_thread(fReaderThread);
// TODO: interrupt read() - doesn't work for whatever reason
//wait_for_thread(fReaderThread, &dummy);
kill_thread(fReaderThread);
fReaderThread = -1;
}
}

View File

@ -328,10 +328,13 @@ TermView::_InitObject(int32 argc, const char **argv)
TermView::~TermView()
{
Shell *shell = fShell;
// _DetachShell sets fShell to NULL
printf("TermView::~TermView()\n");
_DetachShell();
delete fTextBuffer;
delete fShell;
delete shell;
fQuitting = true;
kill_thread(fMouseThread);