1
Description: Fix some random crash in google cover search engine.
2
Origin: http://bazaar.launchpad.net/~anonbeat/guayadeque.player/trunk/revision/1263
3
Applied-Upstream: commit:1263
4
Bug-Ubuntu: https://launchpad.net/bugs/645029
7
src/DbLibrary.cpp | 12 ++++++++----
8
src/Google.cpp | 30 ++++++++++++++++--------------
9
src/Utils.cpp | 8 --------
10
4 files changed, 25 insertions(+), 27 deletions(-)
12
--- guayadeque.orig/src/Db.cpp
13
+++ guayadeque/src/Db.cpp
14
@@ -149,7 +149,7 @@ int guDb::ExecuteUpdate( const wxSQLite3
15
void guDb::SetInitParams( void )
18
- query = wxT( "PRAGMA legacy_file_format=false; PRAGMA page_size=8192; PRAGMA cache_size=4096; PRAGMA count_changes=1; PRAGMA synchronous='OFF'; PRAGMA short_column_names=0; PRAGMA full_column_names=0;" );
19
+ query = wxT( "PRAGMA legacy_file_format=false; PRAGMA page_size=4096; PRAGMA cache_size=4096; PRAGMA count_changes=1; PRAGMA synchronous='OFF'; PRAGMA short_column_names=0; PRAGMA full_column_names=0;" );
20
//query = wxT( "PRAGMA page_size=10240; PRAGMA cache_size=65536; PRAGMA count_changes=1; PRAGMA synchronous='OFF'; PRAGMA short_column_names=0; PRAGMA full_column_names=0;" );
21
ExecuteUpdate( query );
23
--- guayadeque.orig/src/DbLibrary.cpp
24
+++ guayadeque/src/DbLibrary.cpp
25
@@ -1517,6 +1517,8 @@ int guDbLibrary::GetPathId( wxString &Pa
33
wxSQLite3ResultSet dbRes;
34
@@ -1533,22 +1535,24 @@ int guDbLibrary::GetPathId( wxString &Pa
38
- return LastPathId = dbRes.GetInt( 0 );
39
+ RetVal = LastPathId = dbRes.GetInt( 0 );
44
query = wxT( "SELECT MAX(song_pathid) FROM songs;" );
45
dbRes = ExecuteQuery( query );
48
- return LastPathId = dbRes.GetInt( 0 ) + 1;
49
+ RetVal = LastPathId = dbRes.GetInt( 0 ) + 1;
53
- return LastPathId = 1;
54
+ RetVal = LastPathId = 1;
62
// -------------------------------------------------------------------------------- //
63
--- guayadeque.orig/src/Google.cpp
64
+++ guayadeque/src/Google.cpp
65
@@ -119,23 +119,25 @@ int guGoogleCoverFetcher::ExtractImagesI
66
//guLogMessage( wxT( "%s" ), Content.Mid( 0, StrPos ).c_str() );
67
wxHtmlEntitiesParser EntitiesParser;
68
GoogleImage = ExtractImageInfo( EntitiesParser.Parse( content.Mid( 0, StrPos ) ) );
69
- //RetVal.Add( CurImage );
71
- if( GoogleImage[ GOOGLE_COVERINFO_LINK ].IsEmpty() )
72
+ if( GoogleImage.Count() >= GOOGLE_COVERINFO_SIZE )
74
- GoogleImage[ GOOGLE_COVERINFO_LINK ] = ExtractCoverFromGoogleLink( GoogleImage[ 0 ] );
76
+ //RetVal.Add( CurImage );
78
+ if( GoogleImage[ GOOGLE_COVERINFO_LINK ].IsEmpty() )
80
+ GoogleImage[ GOOGLE_COVERINFO_LINK ] = ExtractCoverFromGoogleLink( GoogleImage[ 0 ] );
83
- if( !GoogleImage[ GOOGLE_COVERINFO_LINK ].IsEmpty() )
85
- CurImage.Add( GoogleImage[ GOOGLE_COVERINFO_LINK ] );
86
- CurImage.Add( GoogleImage[ GOOGLE_COVERINFO_SIZE ] );
87
- m_CoverLinks->Add( CurImage );
89
- if( ImageIndex == count )
91
+ if( !GoogleImage[ GOOGLE_COVERINFO_LINK ].IsEmpty() )
93
+ CurImage.Add( GoogleImage[ GOOGLE_COVERINFO_LINK ] );
94
+ CurImage.Add( GoogleImage[ GOOGLE_COVERINFO_SIZE ] );
95
+ m_CoverLinks->Add( CurImage );
97
+ if( ImageIndex == count )
102
//guLogMessage( wxT( "Pos: %u" ), StrPos );
105
--- guayadeque.orig/src/Utils.cpp
106
+++ guayadeque/src/Utils.cpp
107
@@ -202,14 +202,6 @@ wxImage * guGetRemoteImage( const wxStri
111
- if( ResCode != 200 )
113
- guLogMessage( wxT( "Error %u getting remote image '%s'\n%s" ),
114
- http.GetResponseCode(),
116
- http.GetResponseHeader().c_str() );
121
wxMemoryInputStream Ins( Buffer );