Prechádzať zdrojové kódy

fix: dlc中atexit函数也不使用dlclose

SongZihuan 3 rokov pred
rodič
commit
e02744a71a
1 zmenil súbory, kde vykonal 16 pridanie a 1 odobranie
  1. 16 1
      src/tool/dlc.c

+ 16 - 1
src/tool/dlc.c

@@ -75,6 +75,21 @@ static bool freeLibary_(struct DlcHandle *dlc, bool f) {
     return true;
 }
 
+static bool freeLibary_Exit(struct DlcHandle *dlc) {
+    if (dlc->last == NULL)
+        dlc_l = dlc->next;
+    else
+        dlc->last->next = dlc->next;
+
+    /* atexit函数中不使用dlclose */
+
+    if (dlc->next != NULL)
+        dlc->next->last = dlc->last;
+
+    free(dlc);
+    return true;
+}
+
 static void blindSymbol(struct DlcSymbol_ *ds, struct DlcHandle *dlc) {
     if (ds->dlc != NULL)
         ds->dlc->link--;
@@ -136,5 +151,5 @@ void freeSymbol_(struct DlcSymbol_ *symbol) {
 
 void dlcExit(void) {
     while (dlc_l != NULL)
-        freeLibary_(dlc_l, true);
+        freeLibary_Exit(dlc_l);
 }