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

List:       kde-commits
Subject:    KDE/kdegraphics/gwenview/tests
From:       Aurélien Gâteau <agateau () kde ! org>
Date:       2010-10-01 21:53:19
Message-ID: 20101001215319.CCF02AC894 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1181727 by gateau:

Fix SemanticInfoBackEndTest crash

Make sure the backend is deleted *before* a new one is created

 M  +10 -5     semanticinfobackendtest.cpp  
 M  +2 -4      semanticinfobackendtest.h  


--- trunk/KDE/kdegraphics/gwenview/tests/semanticinfobackendtest.cpp #1181726:1181727
@@ -76,13 +76,18 @@
 
 void SemanticInfoBackEndTest::init() {
 #ifdef GWENVIEW_SEMANTICINFO_BACKEND_FAKE
-	mBackEnd.reset(new FakeSemanticInfoBackEnd(0, FakeSemanticInfoBackEnd::InitializeEmpty));
+	mBackEnd = new FakeSemanticInfoBackEnd(0, FakeSemanticInfoBackEnd::InitializeEmpty);
 #elif defined(GWENVIEW_SEMANTICINFO_BACKEND_NEPOMUK)
-	mBackEnd.reset(new NepomukSemanticInfoBackEnd(0));
+	mBackEnd = new NepomukSemanticInfoBackEnd(0);
 #endif
 }
 
+void SemanticInfoBackEndTest::cleanup() {
+	delete mBackEnd;
+	mBackEnd = 0;
+}
 
+
 /**
  * Get and set the rating of a temp file
  */
@@ -94,8 +99,8 @@
 	KUrl url;
 	url.setPath(temp.fileName());
 
-	SemanticInfoBackEndClient client(mBackEnd.get());
-	QSignalSpy spy(mBackEnd.get(), SIGNAL(semanticInfoRetrieved(const KUrl&, const SemanticInfo&)) );
+	SemanticInfoBackEndClient client(mBackEnd);
+	QSignalSpy spy(mBackEnd, SIGNAL(semanticInfoRetrieved(const KUrl&, const SemanticInfo&)) );
 	mBackEnd->retrieveSemanticInfo(url);
 	QVERIFY(waitForSignal(spy));
 
@@ -108,7 +113,7 @@
 
 
 void SemanticInfoBackEndTest::testTagForLabel() {
-	QSignalSpy spy(mBackEnd.get(), SIGNAL(tagAdded(const SemanticInfoTag&, const QString&)) );
+	QSignalSpy spy(mBackEnd, SIGNAL(tagAdded(const SemanticInfoTag&, const QString&)) );
 
 	TagSet oldAllTags = mBackEnd->allTags();
 	QString label = "testTagForLabel-" + KRandom::randomString(5);
--- trunk/KDE/kdegraphics/gwenview/tests/semanticinfobackendtest.h #1181726:1181727
@@ -20,9 +20,6 @@
 #ifndef SEMANTICINFOBACKENDTEST_H
 #define SEMANTICINFOBACKENDTEST_H
 
-// STL
-#include <memory>
-
 // Qt
 #include <QHash>
 #include <QObject>
@@ -63,11 +60,12 @@
 private Q_SLOTS:
 	void initTestCase();
 	void init();
+	void cleanup();
 	void testRating();
 	void testTagForLabel();
 
 private:
-	std::auto_ptr<AbstractSemanticInfoBackEnd> mBackEnd;
+	AbstractSemanticInfoBackEnd* mBackEnd;
 };
 
 } // namespace
[prev in list] [next in list] [prev in thread] [next in thread] 

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