Fixing seg fault on exit. [b=36781, r=dveditz]

This commit is contained in:
sgehani%netscape.com 2000-05-25 00:13:48 +00:00
parent 18688d3585
commit a5516c5d4a
5 changed files with 4 additions and 16 deletions

View File

@ -45,4 +45,4 @@ export PATH
MOZILLA_FIVE_HOME=.
export MOZILLA_FIVE_HOME
exec mozilla-installer-bin
exec ./mozilla-installer-bin --sync

View File

@ -77,6 +77,7 @@ nsInstallDlg::Next(GtkWidget *aWidget, gpointer aData)
{
DUMP("Next");
int bCus;
pthread_t eng_th;
nsComponentList *comps = NULL;
pthread_t *me = (pthread_t *) malloc(sizeof(pthread_t));
@ -112,8 +113,7 @@ nsInstallDlg::Next(GtkWidget *aWidget, gpointer aData)
pthread_cond_init(&gCtx->prog_cv, NULL);
*me = pthread_self();
pthread_create(&gCtx->eng_th, NULL, WorkDammitWork, (void*) me);
gCtx->bThSpawned = TRUE;
pthread_create(&eng_th, NULL, WorkDammitWork, (void*) me);
gtk_timeout_add(1, ProgressUpdater, NULL);
@ -322,6 +322,7 @@ nsInstallDlg::WorkDammitWork(void *arg)
// destroy xpiengine
XI_IF_DELETE(xpiengine);
pthread_mutex_lock(&gCtx->prog_mutex);
gCtx->bDone = TRUE;
gCtx->threadTurn = nsXIContext::UI_THREAD;
pthread_cond_signal(&gCtx->prog_cv);

View File

@ -52,7 +52,6 @@ nsXIContext::nsXIContext()
backID = 0;
nextID = 0;
bMoving = FALSE;
bThSpawned = FALSE;
bDone = FALSE;
threadTurn = nsXIContext::UI_THREAD;

View File

@ -77,12 +77,9 @@ public:
int nextID; /* signal handler id for next btn */
int bMoving; /* when moving between dlgs signals are
emitted twice; this notes the state */
int bThSpawned; /* boolean set so we can "if join" the
engine thread */
int bDone; /* engine thread sets boolean when done
so that ui/main thread can exit */
pthread_t eng_th; /* engine thread: so we can join later */
pthread_mutex_t prog_mutex; /* mutex for sync between ui and eng th */
pthread_cond_t prog_cv; /* cond var for ui/eng th communication */
int threadTurn; /* toggle between engine and ui threads */

View File

@ -290,7 +290,6 @@ main(int argc, char **argv)
{
nsXInstaller *installer = new nsXInstaller();
int err = OK;
void *eng_th_rv = NULL;
if (installer)
{
@ -300,15 +299,7 @@ main(int argc, char **argv)
else
err = E_MEM;
// join engine thread
if (gCtx->bThSpawned)
{
pthread_join(gCtx->eng_th, &eng_th_rv);
DUMP("post pthread_join");
}
XI_IF_DELETE(installer);
DUMP("post nsXInstaller instance deletion");
exit(err);
}