]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tinfo/lib_setup.c
ncurses 6.1 - patch 20180331
[ncurses.git] / ncurses / tinfo / lib_setup.c
index 33cf2f96195f3ee06010e66b7abbadcf7d4a6346..daf51a7e259cb67d6891e91e968902cf2915f24f 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2017,2018 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -48,7 +48,7 @@
 #include <locale.h>
 #endif
 
-MODULE_ID("$Id: lib_setup.c,v 1.188 2017/07/01 18:24:50 tom Exp $")
+MODULE_ID("$Id: lib_setup.c,v 1.191 2018/03/04 01:06:34 tom Exp $")
 
 /****************************************************************************
  *
@@ -722,8 +722,6 @@ TINFO_SETUP_TERM(TERMINAL **tp,
            termp->Filedes = (short) Filedes;
            termp->_termname = strdup(tname);
        } else {
-           _nc_free_termtype2(&TerminalType(termp));
-           free(my_tcb);
            ret_error0(errret ? *errret : TGETENT_ERR,
                       "Could not find any driver to handle this terminal.\n");
        }
@@ -829,8 +827,9 @@ _nc_find_prescr(void)
 {
     SCREEN *result = 0;
     PRESCREEN_LIST *p;
+    pthread_t id = GetThreadID();
     for (p = _nc_prescreen.allocated; p != 0; p = p->next) {
-       if (p->id == pthread_self()) {
+       if (p->id == id) {
            result = p->sp;
            break;
        }
@@ -847,8 +846,9 @@ NCURSES_EXPORT(void)
 _nc_forget_prescr(void)
 {
     PRESCREEN_LIST *p, *q;
+    pthread_t id = GetThreadID();
     for (p = _nc_prescreen.allocated, q = 0; p != 0; q = p, p = p->next) {
-       if (p->id == pthread_self()) {
+       if (p->id == id) {
            if (q) {
                q->next = p->next;
            } else {
@@ -884,7 +884,7 @@ new_prescr(void)
 #ifdef USE_PTHREADS
            PRESCREEN_LIST *p = typeCalloc(PRESCREEN_LIST, 1);
            if (p != 0) {
-               p->id = pthread_self();
+               p->id = GetThreadID();
                p->sp = sp;
                p->next = _nc_prescreen.allocated;
                _nc_prescreen.allocated = p;