To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=58412





------- Additional comments from [EMAIL PROTECTED] Sat Jan 14 11:05:20 -0800 
2006 -------
nemeth->tl: I have made a CWS, called thesau03. It seems, there is a problem
with EIS, because I cannot modify the attributes of this CWS.

Solved problems: with missing .dat file, constructor deallocated
the "encoding", "list" and "offst" variables, but did't initialize them with
NULL value, hence destructor caused a crash. OOo also read the deallocated
"encoding" during thesaurus usage. Unsufficient memory was also a potential
source of error.

Diff:

diff -u -r lingucomponent/source/thesaurus/mythes/CVS/Entries
lingucomponent.thesau03/source/thesaurus/mythes/CVS/Entries
--- lingucomponent/source/thesaurus/mythes/CVS/Entries  2006-01-14
17:41:14.557088904 +0100
+++ lingucomponent.thesau03/source/thesaurus/mythes/CVS/Entries 2006-01-14
15:56:05.066277304 +0100
@@ -1,10 +1,10 @@
-/Makefile/1.3/Tue Mar  9 12:43:17 2004//TSRC680_m150
-/README/1.2/Wed Feb  4 13:06:56 2004//TSRC680_m150
-/checkme.lst/1.2/Wed Feb  4 13:07:14 2004//TSRC680_m150
-/data_layout.txt/1.2/Wed Feb  4 13:07:34 2004//TSRC680_m150
-/example.cxx/1.2/Wed Feb  4 13:07:50 2004//TSRC680_m150
-/license.readme/1.2/Wed Feb  4 13:08:09 2004//TSRC680_m150
-/makefile.mk/1.4/Wed Sep  7 19:45:38 2005//TSRC680_m150
-/mythes.cxx/1.4/Wed Dec 14 09:42:54 2005//TSRC680_m150
-/mythes.hxx/1.3/Tue Mar  9 12:43:40 2004//TSRC680_m150
+/Makefile/1.3/Tue Mar  9 12:43:17 2004//Tcws_src680_thesau03
+/README/1.2/Wed Feb  4 13:06:56 2004//Tcws_src680_thesau03
+/checkme.lst/1.2/Wed Feb  4 13:07:14 2004//Tcws_src680_thesau03
+/data_layout.txt/1.2/Wed Feb  4 13:07:34 2004//Tcws_src680_thesau03
+/example.cxx/1.2/Wed Feb  4 13:07:50 2004//Tcws_src680_thesau03
+/license.readme/1.2/Wed Feb  4 13:08:09 2004//Tcws_src680_thesau03
+/makefile.mk/1.4/Wed Sep  7 19:45:38 2005//Tcws_src680_thesau03
+/mythes.cxx/1.4.6.1/Sat Jan 14 14:54:18 2006//Tcws_src680_thesau03
+/mythes.hxx/1.3.54.1/Sat Jan 14 14:54:26 2006//Tcws_src680_thesau03
 D
diff -u -r lingucomponent/source/thesaurus/mythes/CVS/Tag
lingucomponent.thesau03/source/thesaurus/mythes/CVS/Tag
--- lingucomponent/source/thesaurus/mythes/CVS/Tag      2006-01-14 
17:41:14.557088904
+0100
+++ lingucomponent.thesau03/source/thesaurus/mythes/CVS/Tag     2006-01-14
15:22:47.790909312 +0100
@@ -1 +1 @@
-NSRC680_m150
+Tcws_src680_thesau03
diff -u -r lingucomponent/source/thesaurus/mythes/mythes.cxx
lingucomponent.thesau03/source/thesaurus/mythes/mythes.cxx
--- lingucomponent/source/thesaurus/mythes/mythes.cxx   2005-12-14
10:42:54.000000000 +0100
+++ lingucomponent.thesau03/source/thesaurus/mythes/mythes.cxx  2006-01-14
15:54:18.050546168 +0100
@@ -18,9 +18,7 @@
     if (thInitialize(idxpath, datpath) != 1) {
         fprintf(stderr,"Error - can't open %s or %s\n",idxpath, datpath);
         fflush(stderr);
-        if (encoding) free((void*)encoding);
-        if (list)  free((void*)list);
-        if (offst) free((void*)offst);
+        thCleanup();
         // did not initialize properly - throw exception?
     }
 }
@@ -28,13 +26,7 @@
 
 MyThes::~MyThes()
 {
-    if (thCleanup() != 1) {
-        /* did not cleanup properly - throw exception? */
-    }
-    if (encoding) free((void*)encoding);
-    encoding = NULL;
-    list = NULL;
-    offst = NULL;
+    thCleanup();
 }
 
 
@@ -51,6 +43,11 @@
     // parse in encoding and index size */    
     char * wrd;
     wrd = (char *)calloc(1, MAX_WD_LEN);
+    if (!wrd) {
+       fprintf(stderr,"Error - bad memory allocation\n");
+       fflush(stderr);
+       return 0;
+    }
     int len = readLine(pifile,wrd,MAX_WD_LEN);
     encoding = mystrdup(wrd);
     len = readLine(pifile,wrd,MAX_WD_LEN);
@@ -76,10 +73,15 @@
            if (np >= 0) {          
               *(wrd+np) = '\0';
               list[nw] = (char *)calloc(1,(np+1));
+              if (!list[nw]) {
+                 fprintf(stderr,"Error - bad memory allocation\n");
+                 fflush(stderr);
+                 return 0;
+              }
               memcpy((list[nw]),wrd,np);
               offst[nw] = atoi(wrd+np+1);
               nw++;
-          }
+           }
         }
         len = readLine(pifile,wrd,MAX_WD_LEN);
     }
@@ -99,7 +101,7 @@
 }
 
 
-int MyThes::thCleanup()
+void MyThes::thCleanup()
 {
     /* first close the data file */
     if (pdfile) {
@@ -116,11 +118,13 @@
         }
     }
 
+    if (encoding) free((void*)encoding);
     if (list)  free((void*)list);
     if (offst) free((void*)offst);
-
+    encoding = NULL;
+    list = NULL;
+    offst = NULL;
     nw = 0;
-    return 1;
 }
 
 
diff -u -r lingucomponent/source/thesaurus/mythes/mythes.hxx
lingucomponent.thesau03/source/thesaurus/mythes/mythes.hxx
--- lingucomponent/source/thesaurus/mythes/mythes.hxx   2004-03-09
13:43:40.000000000 +0100
+++ lingucomponent.thesau03/source/thesaurus/mythes/mythes.hxx  2006-01-14
15:54:26.585248696 +0100
@@ -49,7 +49,7 @@
         int thInitialize (const char* indxpath, const char* datpath);
         
         // internal close and cleanup dat and idx files
-        int thCleanup ();
+        void thCleanup ();
 
         // read a text line (\n terminated) stripping off line terminator
         int readLine(FILE * pf, char * buf, int nc);


---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to