Commit a3d378de authored by Matěj Laitl's avatar Matěj Laitl
Browse files

AudioCdCollection: don't create a reference out of temporary var (crashfix)

There's following code in AudioCdCollection::updateProxyTracks():
const QString &urlString = url.url().remove( "audiocd:/" );

Which I think is wrong, because url.url() returns a temporary QString
and QString::remove() returns a reference to itself. However, the
temporary is AFAICS destroyed as soon as this line ends. This IMO
results in urlString being an invalid reference.

I'm not really sure about this, I haven't read C++ spec, but given many
users report crash on the following line, this could be the culprit.
I was never able to reproduce the bug, so I'm shooting blindly.

Reporters, please test reproducibility with current git and reopen if
this is not fixed.

BUG: 256585
DIGEST: fix grave crash
parent da543740
......@@ -84,6 +84,7 @@ VERSION 2.6-Beta 1
"1.2 GB free" is shown instead of "85% used"; thicker capacity bar.
* Fix crash on startup related to Audio CD collection. (BR 256585)
* When turning dynamic playlist on, immediately populate playlist and clear
any possible playlist sorting. (BR 220558)
* Fix transcoding with ffmpeg >= 0.10; patch by Julian Simioni.
......@@ -575,7 +575,7 @@ AudioCdCollection::updateProxyTracks()
foreach( const KUrl &url, m_proxyMap.keys() )
const QString &urlString = url.url().remove( "audiocd:/" );
QString urlString = url.url().remove( "audiocd:/" );
const QStringList &parts = urlString.split( '/' );
if( parts.count() != 2 )
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment