[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-multimedia
Subject:    crash in libkccdb, reason found
From:       Alexander Neundorf <neundorf () kde ! org>
Date:       2004-06-19 20:11:50
Message-ID: 200406192211.50842.neundorf () kde ! org
[Download RAW message or body]

Hi,

the following code crashes (with Pantera - Reinventing The Steel):

      KCDDB::Config cddbConfig;
      cddbConfig.load();
      KCDDB::Client cddbClient(cddbConfig);
      cddbClient.setBlockingMode(true);
      KCDDB::TrackOffsetList list;
      for (unsigned int i=0; i<m_diskInfo->tracks.count()-1; i++)
         list<<m_diskInfo->tracks[i];
      list<<0;
      list<<m_diskInfo->tracks[m_diskInfo->tracks.count()-1];
     KCDDB::CDDB::Result r = cddbClient.lookup(list);
      KCDDB::CDInfoList response = cddbClient.lookupResponse();
      KCDDB::CDInfoList::ConstIterator it = response.begin();
      if (it!= response.end())
      {
         KCDDB::CDInfo cdi(*it);
         m_diskPage->m_diskTitle->setText(i18n("<b>Audio CD: %1 - %2
(%3)</b>").arg(cdi.artist).arg(cdi.title).arg(cdi.year));
         int i=0;
         for (QListViewItem *track=m_diskPage->m_dvdLv->firstChild();
track!=0; track=track->nextSibling())
         {
            track->setText(1,cdi.trackInfoList[i].title);
            i++;
         }
      }

It crashes in the dtor of the KCDDB::Config object.
The reason is (probably) the following code:

 Client::Client(const Config & config) : QObject(),
    cdInfoLookup(0),
    cdInfoSubmit(0)
  {
    d = new Private;
    d->config = config;   //// this line
  }

I didn't find an implementation neither of an operator= nor of a copy ctor for 
Config, ConfigBase or KConfigSkeleton. So it seems the default copy ctor is 
used. This can't be a good thing since KConfigSkeleton has a private 
d-pointer. So in the dtor of the with operator= copied Config object this 
d-pointer will probably be deleted a second time -> crash.

What's the right way to fix this ?
-making the copy ctor in KConfigSkeleton private
-insert a #warning in the Client(const Config&) ctor
-something else which actually fixes the problem

Bye
Alex
-- 
Work: alexander.neundorf@jenoptik.com - http://www.jenoptik-los.de
Home: neundorf@kde.org                - http://www.kde.org
      alex@neundorf.net               - http://www.neundorf.net
_______________________________________________
kde-multimedia mailing list
kde-multimedia@kde.org
https://mail.kde.org/mailman/listinfo/kde-multimedia
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic