Summary: | amarok crash while setting similar artist applet [@ Collections::SqlQueryMaker::reset] | ||
---|---|---|---|
Product: | [Applications] amarok | Reporter: | omega <biasquez> |
Component: | Context View/Similar Artists | Assignee: | Amarok Developers <amarok-bugs-dist> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | jclavel, lfranchi, maximilian.kossick, mitchell |
Priority: | NOR | ||
Version: | 2.3.0.90 | ||
Target Milestone: | --- | ||
Platform: | Ubuntu | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 2.3.1 | |
Sentry Crash Report: |
Description
omega
2010-05-04 17:02:27 UTC
Very similar backtrace to bug 235443. commit 61e1838cea44816e73511cd0c1fdfb9c5c3e365d Author: Maximilian Kossick <maximilian.kossick@googlemail.com> Date: Wed May 5 07:16:05 2010 +0200 added test for crash in SqlQueryMaker::reset CCBUG: 236333 diff --git a/tests/core-impl/collections/sqlcollection/TestSqlQueryMaker.cpp b/tests/core-impl/collections/sqlcollection/TestSqlQueryMaker.cpp index 15d6c4d..3bc663c 100644 --- a/tests/core-impl/collections/sqlcollection/TestSqlQueryMaker.cpp +++ b/tests/core-impl/collections/sqlcollection/TestSqlQueryMaker.cpp @@ -1151,4 +1151,39 @@ TestSqlQueryMaker::testLabelQueryMode() } +void +TestSqlQueryMaker::testResetRunningQuery() +{ + for( int i = 0; i < 10; i++ ) + { + int iteration = 0; + bool queryNotDoneYet = true; + Collections::SqlQueryMaker *qm = new Collections::SqlQueryMaker( m_collection ); + + //wait one second per query in total, that should be enough for it to complete + do + { + QSignalSpy spy( qm, SIGNAL(queryDone()) ); + qm->setQueryType( Collections::QueryMaker::Track ); + qm->addFilter( Meta::valTitle, QString::number( iteration), false, false ); + qm->run(); + //wait 2 msec more per iteration, might have to be tweaked + if( iteration > 0 ) + { + QTest::qWait( 2 * iteration ); + } + qm->reset(); + queryNotDoneYet = ( spy.count() == 0 ); + if( iteration > 50 ) + { + break; + } + QTest::qWait( 1000 - 2 * iteration ); + iteration++; + } while ( queryNotDoneYet ); + //delete qm; + qDebug() << "Iterations: " << iteration; + } +} + #include "TestSqlQueryMaker.moc" diff --git a/tests/core-impl/collections/sqlcollection/TestSqlQueryMaker.h b/tests/core-impl/collections/sqlcollection/TestSqlQueryMaker.h index f3c3d2c..aafd1c0 100644 --- a/tests/core-impl/collections/sqlcollection/TestSqlQueryMaker.h +++ b/tests/core-impl/collections/sqlcollection/TestSqlQueryMaker.h @@ -91,6 +91,8 @@ private slots: void testLabelQueryMode_data(); void testLabelQueryMode(); + void testResetRunningQuery(); + private: Collections::SqlCollection *m_collection; SqlMountPointManagerMock *m_mpm; commit eab0793211369e70d6ba004f8b3d5e6092fe27ca Author: Maximilian Kossick <maximilian.kossick@googlemail.com> Date: Thu May 6 18:31:36 2010 +0200 do not keep querymakers around if you do not have to. fixes symptom (crash) but not the root cause CCBUG: 236333 diff --git a/src/context/applets/similarartists/ArtistWidget.cpp b/src/context/applets/similarartists/ArtistWidget.cpp index cdb4d0e..4694fc7 100644 --- a/src/context/applets/similarartists/ArtistWidget.cpp +++ b/src/context/applets/similarartists/ArtistWidget.cpp @@ -46,7 +46,6 @@ */ ArtistWidget::ArtistWidget( QWidget *parent ) : QWidget( parent ) - , m_qm( 0 ) { // set a fixed size for all widget, for harmonize the similar artists applet display @@ -237,22 +236,18 @@ ArtistWidget::setArtist( const QString &nom, const KUrl &url ) //Figure out of this applet is present in the local collection, and show the "show in collection" button if so m_navigateButton->hide(); - if( m_qm ) - m_qm->reset(); - else - { - Collections::Collection *coll = CollectionManager::instance()->primaryCollection(); - m_qm = coll->queryMaker(); - } + Collections::Collection *coll = CollectionManager::instance()->primaryCollection(); + Collections::QueryMaker *qm = coll->queryMaker(); - m_qm->setQueryType( Collections::QueryMaker::Artist ); - m_qm->addFilter( Collections::QueryMaker::ArtistFilter, m_name ); - m_qm->limitMaxResultSize( 1 ); + qm->setQueryType( Collections::QueryMaker::Artist ); + qm->addFilter( Collections::QueryMaker::ArtistFilter, m_name ); + qm->limitMaxResultSize( 1 ); + qm->setAutoDelete( true ); - connect( m_qm, SIGNAL( newResultReady( QString, Meta::ArtistList ) ), + connect( qm, SIGNAL( newResultReady( QString, Meta::ArtistList ) ), SLOT( resultReady( QString, Meta::ArtistList ) ), Qt::QueuedConnection ); - m_qm->run(); + qm->run(); } diff --git a/src/context/applets/similarartists/ArtistWidget.h b/src/context/applets/similarartists/ArtistWidget.h index 23157e6..f5f7a59 100644 --- a/src/context/applets/similarartists/ArtistWidget.h +++ b/src/context/applets/similarartists/ArtistWidget.h @@ -168,13 +168,6 @@ private: */ KJob *m_imageJob; - /** - * QueryMaker used for checking if a given artist exists in the local collection. - */ - Collections::QueryMaker *m_qm; - - - private slots: /** * Put the image of the artist in the QPixMap |