Bug 87004 - INDEX field not available for vector after creating a vector
Summary: INDEX field not available for vector after creating a vector
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: George Staikos
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-11 23:53 UTC by Rick Chern
Modified: 2004-08-12 00:35 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rick Chern 2004-08-11 23:53:43 UTC
Version:           0.99-devel (using KDE KDE 3.2.1)
Installed from:    Compiled From Sources
Compiler:          gcc (GCC) 3.3.2 20031022  
OS:                Linux

The INDEX field for the new vector dialog becomes blank after creating a new vector.

How to reproduce:
- start Kst
- create a vector through the data manager, or through data wizard
- click "Vector" in the data manager to create another vector
- note the INDEX field has become blank
- click the drop-down list to view the available fields
- close the dialog
- click "Vector" in the data manager to create a vector again
 
Kst crashes (no useful backtrace).

Expected behaviour:
The INDEX field does not disappear and Kst does not crash.
Comment 1 George Staikos 2004-08-12 00:17:27 UTC
Appears to be a kdelibs bug.  We might have to make a choice here:
1) update the editable state
2) support completion
Comment 2 George Staikos 2004-08-12 00:34:32 UTC
False alarm, I found the problem - stale pointer in the dialog that was never triggered until setEditable().  Understandable since KComboBox deletes that pointer on you without warning.
Comment 3 George Staikos 2004-08-12 00:35:28 UTC
CVS commit by staikos: 

today's lesson: beware KComboBox's pointers - it may delete them on you
CCMAIL: 87004-done@bugs.kde.org


  M +18 -5     kstvectordialog_i.cpp   1.47
  M +1 -1      kstvectordialog_i.h   1.17


--- kdeextragear-2/kst/kst/kstvectordialog_i.cpp  #1.46:1.47
@@ -98,7 +98,14 @@ void KstVectorDialogI::updateCompletion(
   }
 
+  _fieldCompletion = Field->completionObject();
+
   Field->insertStringList(list);
+  if (_fieldCompletion) {
+    _fieldCompletion->clear();
   _fieldCompletion->insertItems(list);
+  }
+  if (!current_text.isEmpty() && (list.contains(current_text) || Field->editable())) {
   Field->setCurrentText(current_text);
+  }
 }
 
@@ -114,5 +121,7 @@ void KstVectorDialogI::_fillFieldsForEdi
   /* fill the fields */
   Field->clear();
+  if (_fieldCompletion) {
   _fieldCompletion->clear();
+  }
   KstDataSourcePtr tf;
   {
@@ -123,11 +132,15 @@ void KstVectorDialogI::_fillFieldsForEdi
       tf->readLock();
       Field->insertStringList(tf->fieldList());
+      if (_fieldCompletion) {
       _fieldCompletion->insertItems(tf->fieldList());
+      }
       tf->readUnlock();
     } else {
       QStringList list = KstDataSource::fieldListForSource(FileName->url());
       Field->insertStringList(list);
+      if (_fieldCompletion) {
       _fieldCompletion->insertItems(list);
     }
+    }
     KST::dataSourceList.lock().readUnlock();
   }

--- kdeextragear-2/kst/kst/kstvectordialog_i.h  #1.16:1.17
@@ -48,5 +48,5 @@ class KstVectorDialogI : public KstVecto
   private:
     static KstVectorDialogI *_inst;
-    KCompletion *_fieldCompletion;
+    QGuardedPtr<KCompletion> _fieldCompletion;
     KstRVectorPtr _getPtr(const QString &tagin);