Review Request 118988: AsyncMusicBrainzLookup: fix a crash and a memory leak

Frank Schaefer fschaefer.oss at
Sat Jun 28 11:01:52 BST 2014

This is an automatically generated e-mail. To reply, visit:

Review request for KDE Multimedia.

Bugs: 336678

Repository: libkcddb


>From the documentation of QThread::~QThread():
"... Note that deleting a QThread object will not stop the execution of the thread it manages.
Deleting a running QThread (i.e. isFinished() returns false) will probably result in a program crash.
Wait for the finished() signal before deleting the QThread."

The destructor of class AsyncMusicBrainzLookup currently just deletes the lookup thread object
and does _not_ wait for the running thread to finish.
This causes crashes with the Audex CDDA extraction tool and likely also other users of libkcddb.

In addition to that, we are leaking the memory of a previously intstanciated lookup thread object if
the lookup() method is called multiple times.

Solve both issues by making the lookup thread object "self-destructive".
This way we can maintain the current behavior of the destructor (non-blocking) and
the lookup() method (always start a new lookup without canceling pending lookups).
As part of the solution the lookup thread is modifed to deliver the lookup results
directly with the "lookupFinished" signal. This has two benefits:
1.) the queued signal-slot connection avoids thread synchronization/locking issues
2.) some class members become obsolete


  libkcddb/musicbrainz/asyncmusicbrainzlookup.h 373fb16 
  libkcddb/musicbrainz/asyncmusicbrainzlookup.cpp c13c94f 





Frank Schaefer

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>
-------------- next part --------------
kde-multimedia mailing list
kde-multimedia at

More information about the kde-multimedia mailing list