Fix for dtinfo segfaults
authorUlrich Wilkens <mail@uwilkens.de>
Thu, 20 Feb 2014 18:48:56 +0000 (19:48 +0100)
committerJon Trulson <jon@radscan.com>
Sun, 23 Feb 2014 02:18:07 +0000 (19:18 -0700)
cde/programs/dtinfo/dtinfo/src/Agents/IcccmAgent.C
cde/programs/dtinfo/dtinfo/src/Query/QueryGroup.C
cde/programs/dtinfo/dtinfo/src/UAS/DtSR/DtSR_SearchEngine.C
cde/programs/dtinfo/dtinfogen/infolib/etc/dtinfogen_worker.c

index a7c912b1e4070076f0e5cec503e883cdb3b74eea..0f3f14d6db7f16571b7e711f8d9c62e3e06ed595 100644 (file)
@@ -141,11 +141,7 @@ IcccmAgent::value_handler(Widget w, XtPointer ia, Atom *selection,
             free(wcs);
         }
 #endif
-#if 0
         (((IcccmAgent*)ia)->*f_string_handler)((char*)value, *length);
-#else
-        (((IcccmAgent*)f_real_object)->*f_string_handler)((char*)value, *length);
-#endif
         XtFree((char*)value);
     }
     else if (*type == XA_COMPOUND_TEXT(XtDisplay(w))) {
@@ -168,11 +164,7 @@ IcccmAgent::value_handler(Widget w, XtPointer ia, Atom *selection,
             *((char *) memcpy(mbs, string_list[i], len) + len) = '\0';
         }
         XwcFreeStringList((wchar_t**)string_list);
-#if 0
         (((IcccmAgent*)ia)->*f_string_handler)(mbs, strlen(mbs));
-#else
-        (((IcccmAgent*)f_real_object)->*f_string_handler)(mbs, strlen(mbs));
-#endif
         free((void*)mbs);
     }
     else {
index 09a09211b7ac617b9eacfab9539be71eef018821..3be6fae420be91856785d5cbcc28811b29084d10 100644 (file)
@@ -383,7 +383,7 @@ QueryGroup::gen_query_internal (query_type_t query_type)
 int
 QueryGroup::format (query_type_t query_type, QueryTerm *term)
 {
-  char *s = (char*)"\001s", *tmp;
+  char *s = strdup("\001s"), *tmp;
   // Need two buffers for alternating writes. 
   // Allocate a buffer with enough room for term plus operators.
   static char *buf[2];
index 137cc1f599fc1bfcfeb8bf2b70a2ad6b025b5083..b2262f9cd93b512009db35b6b9b9b91b74d4e533 100644 (file)
@@ -620,6 +620,11 @@ DtSR_SearchEngine::search(UAS_String oql, UAS_SearchScope& scope,
            UAS_String msg(CATGETS(Set_DtSR_SearchEngine, 1,
                                "DtSearch does not support the query."));
            DtSearchFreeMessages();
+
+           if (current_bc != 0) {
+               targets.remove(current_bc);
+               current_bc = NULL;
+           }
            throw(CASTUASEXCEPT UAS_Exception(msg));
 
            continue;
@@ -692,10 +697,10 @@ DtSR_SearchEngine::search(UAS_String oql, UAS_SearchScope& scope,
        UAS_Pointer<DtSR_Stems> stems = bookcases[index]->takeover_stems();
 
        UAS_Pointer<UAS_String> q = new UAS_String(oql);
-       UAS_Pointer<UAS_String> n = new UAS_String(scope.name());
+       UAS_Pointer<UAS_String> s = new UAS_String(scope.name());
 
        UAS_Pointer<DtSR_SearchResults> DtSR_res =
-                       new DtSR_SearchResults(q, n, res, res->length(),
+                       new DtSR_SearchResults(q, s, res, res->length(),
                                        stems, scope.search_zones(), stype);
 
        if (DtSR_result == (int)0)
index 35b214846975bcafc3135bde88c725da3c773830..1e8e96d15129724d01c79eddea84e8a718ff6d8f 100644 (file)
@@ -1867,7 +1867,7 @@ buildTOC(int argc, char *argv[])
     len = MIN(strlen(gStruct->id), MAXPATHLEN);
     *((char *) memcpy (idBuf, gStruct->id, len) + len) = '\0';
     len = MIN(strlen(gStruct->title), MAXPATHLEN);
-    *((char *) memcpy (titleBuf, gStruct->id, len) + len) = '\0';
+    *((char *) memcpy (titleBuf, gStruct->title, len) + len) = '\0';
 
     if (checkStat(gStruct->outFile, FSTAT_IS_FILE))
     {