Bug 96039

Summary: d2asc crashes on dirfiles
Product: [Applications] kst Reporter: Matthew Truch <matt>
Component: generalAssignee: kst
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: 1.x   
Target Milestone: ---   
Platform: Slackware   
OS: Linux   
Latest Commit: Version Fixed In:

Description Matthew Truch 2004-12-30 19:37:09 UTC
Version:           1.1.0_devel (using KDE KDE 3.3.2)
Installed from:    Slackware Packages
OS:                Linux

d2asc segfaults any time you try and extract any dirfile data.  It segfaults before any data is extracted.   

This is true with d2asc from kst 1.0.0 as well as recent cvs.
Comment 1 George Staikos 2005-01-05 06:31:22 UTC
CVS commit by staikos: 

Fix most of the dirfile crash problems, but not all of it.  It crashes on exit
now.

CCBUG: 96039


  M +32 -0     d2asc.cpp   1.18


--- kdeextragear-2/kst/kst/d2asc.cpp  #1.17:1.18
@@ -1,7 +1,28 @@
+/***************************************************************************
+                                d2asc.cpp
+                             -------------------
+    begin                : Tue Aug 22 13:46:13 CST 2000
+    copyright            : (C) 2000 by Barth Netterfield
+    email                :
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
 #include <stdlib.h> // atoi
+#include <kconfig.h>
 #include <kinstance.h>
 
+// hack to make main() a friend of kstdatasource
+#define protected public
 #include "kstrvector.h"
 #include "kstdatacollection.h"
+#undef protected
 
 void Usage() {
@@ -12,9 +33,20 @@ void Usage() {
 }
 
+
+static void exitHelper() {
+  KST::vectorList.clear();
+  KST::scalarList.clear();
+  KST::dataObjectList.clear();
+}
+
 int main(int argc, char *argv[]) {
+  atexit(exitHelper);
   KInstance inst("d2asc");
   KstDataSourcePtr file;
   int i;
 
+  KConfig *kConfigObject = new KConfig("kstdatarc", false, false);
+  KstDataSource::setupOnStartup(kConfigObject);
+
   char field_list[40][120], filename[180];
   bool do_hex[40];


Comment 2 George Staikos 2005-01-05 06:35:34 UTC
CVS commit by staikos: 

the rest of the crashes in d2asc
BUG: 96039


  M +0 -1      d2asc.cpp   1.19


--- kdeextragear-2/kst/kst/d2asc.cpp  #1.18:1.19
@@ -103,5 +103,4 @@ int main(int argc, char *argv[]) {
   /** make vectors and fill the list **/
   QPtrList<KstRVector> vlist;
-  vlist.setAutoDelete(true);
 
   for (i=0; i<n_field; i++) {