help please! i am getting crashes at a trivial point where there should be no crashes and i can't understand why. I am afraid this is going to be rather long, simply because i will have to quote some stuff, probably you can read this from bottom (where i include a trace) to top.

i have one class cMassnahme, which is a subclass of QListWidgetItem and is initiated as a singleton.

the cMassnahme-objects are created by my mainwindow (MainWindow). There can be more than one cMassnahme object with different ids which seems to work.

(listMassnahmen is a QListWidgetItem which will be parent )

Qt Code:
  1. void MainWindow::fillMassnahmen() {
  2. QString sql="SELECT idMassnahme,bezeichnung FROM pMassnahmen";
  3. QSqlQuery query(sql,db);
  4. massnahmen.clear();
  5.  
  6. cbMassnahme->insertItem(0,"--- please choose ---");
  7. int row = 1;
  8. while (query.next()) {
  9. QString id = query.value(0).toString();
  10. QString bez = query.value(1).toString();
  11. cMassnahme* currMass = cMassnahme::self(id,listMassnahmen);
  12.  
  13. // Fill a Combobox as well
  14. cbMassnahme->insertItem(row,currMass->getBezeichnung());
  15.  
  16. // some QMaps to make sure i find my stuff again
  17. massnahmen[id] = currMass;
  18. massnahmenIDs[id] = row;
  19. massnahmeFromID[row] = currMass;
  20.  
  21. row++;
  22. }
  23. }
To copy to clipboard, switch view to plain text mode 

later on i open a new window of the class ConfigWindow from MainWindow. I need a combobox that will allow me to choose between the massnahmen in this Window as well. to create this i have a very simple function:

Qt Code:
  1. void ConfigWindow::fillMassnahmen() {
  2. cbMassnahmen->insertItems(0,mw->getMassnahmenContent());
  3. }
To copy to clipboard, switch view to plain text mode 
which should work, as mw is a pointer to the mainwindow-class. and the getMassnahmenContent() looks like this:
Qt Code:
  1. QStringList MainWindow::getMassnahmenContent() {
  2. int allM = cbMassnahme->count();
  3. for (int i=0;i<allM;i++) {
  4. list.insert(i,cbMassnahme->itemText(i));
  5. }
  6. return list;
  7. }
To copy to clipboard, switch view to plain text mode 
up to this point everything seems to work. now while the combobox in ConfigWindow is filled this slot is called:
Qt Code:
  1. void ConfigWindow::on_cbMassnahmen_currentIndexChanged ( int index) {
  2. QLocale loc;
  3.  
  4. currentMassnahme = mw->getMassnahmeFromRow(index);
  5. QString bez = currentMassnahme->getBezeichnung();
  6. ...
To copy to clipboard, switch view to plain text mode 
the two functions here are rather simple as well. mw is a pointer back to the MainWindow, with the function

Qt Code:
  1. cMassnahme* MainWindow::getMassnahmeFromRow(int row) {
  2. return massnahmeFromID[row];
  3. }
To copy to clipboard, switch view to plain text mode 
and the second line refering to this function:

Qt Code:
  1. QString cMassnahme::getBezeichnung() {
  2. return bezeichnung;
  3. }
To copy to clipboard, switch view to plain text mode 

now, finally, the funny part: the application crashes in the last function! DrMingw gives me this trace:
Call stack:
004D3C48 werter.exe:004D3C48 QString::QString(QString const&) qstring.h:608
...
{ if (!isNull()) *this = QString(); }
inline QString::QString(const QString &s) : d(s.d)
> { Q_ASSERT(&s != this); d->ref.ref(); }
inline int QString::capacity() const
{ return d->alloc; }
...

0043B0CC werter.exe:0043B0CC cMassnahme::getBezeichnung() massnahme.cpp:82
...
QString cMassnahme::getBezeichnung() {
return bezeichnung;
> }

float cMassnahme::getKostenNettoSumme() {
...

0045B0AB werter.exe:0045B0AB ConfigWindow:n_cbMassnahmen_currentIndexChanged(int) ConfigWindow.cpp:259
...

currentMassnahme = mw->getMassnahmeFromRow(index);
> QString bez = currentMassnahme->getBezeichnung();

leBezeichnung->setText(bez);
...
any idea what should bother the application at this point?