~ubuntu-branches/ubuntu/vivid/guayadeque/vivid

« back to all changes in this revision

Viewing changes to debian/patches/02-google_cover_search_engine_crash.patch

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2011-02-25 11:59:10 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110225115910-13phl46pz0rgqg0a
Tags: 0.2.9-1
* Imported Upstream version 0.2.9
* Drop 02-google_cover_search_engine_crash.patch patch, applied upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
5
 
---
6
 
 src/Db.cpp        |    2 +-
7
 
 src/DbLibrary.cpp |   12 ++++++++----
8
 
 src/Google.cpp    |   30 ++++++++++++++++--------------
9
 
 src/Utils.cpp     |    8 --------
10
 
 4 files changed, 25 insertions(+), 27 deletions(-)
11
 
 
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 )
16
 
 {
17
 
   wxString query;
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 );
22
 
 }
23
 
--- guayadeque.orig/src/DbLibrary.cpp
24
 
+++ guayadeque/src/DbLibrary.cpp
25
 
@@ -1517,6 +1517,8 @@ int guDbLibrary::GetPathId( wxString &Pa
26
 
       return LastPathId;
27
 
   }
28
 
 
29
 
+  int RetVal = 0;
30
 
+
31
 
 //TODO Add a Lock
32
 
   wxString query;
33
 
   wxSQLite3ResultSet dbRes;
34
 
@@ -1533,22 +1535,24 @@ int guDbLibrary::GetPathId( wxString &Pa
35
 
 
36
 
   if( dbRes.NextRow() )
37
 
   {
38
 
-    return LastPathId = dbRes.GetInt( 0 );
39
 
+    RetVal = LastPathId = dbRes.GetInt( 0 );
40
 
   }
41
 
   else
42
 
   {
43
 
+    dbRes.Finalize();
44
 
     query = wxT( "SELECT MAX(song_pathid) FROM songs;" );
45
 
     dbRes = ExecuteQuery( query );
46
 
     if( dbRes.NextRow() )
47
 
     {
48
 
-        return LastPathId = dbRes.GetInt( 0 ) + 1;
49
 
+        RetVal = LastPathId = dbRes.GetInt( 0 ) + 1;
50
 
     }
51
 
     else
52
 
     {
53
 
-        return LastPathId = 1;
54
 
+        RetVal = LastPathId = 1;
55
 
     }
56
 
   }
57
 
-  return 0;
58
 
+  dbRes.Finalize();
59
 
+  return RetVal;
60
 
 }
61
 
 
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 );
70
 
-        CurImage.Empty();
71
 
-        if( GoogleImage[ GOOGLE_COVERINFO_LINK ].IsEmpty() )
72
 
+        if( GoogleImage.Count() >= GOOGLE_COVERINFO_SIZE )
73
 
         {
74
 
-            GoogleImage[ GOOGLE_COVERINFO_LINK ] = ExtractCoverFromGoogleLink( GoogleImage[ 0 ] );
75
 
-        }
76
 
+            //RetVal.Add( CurImage );
77
 
+            CurImage.Empty();
78
 
+            if( GoogleImage[ GOOGLE_COVERINFO_LINK ].IsEmpty() )
79
 
+            {
80
 
+                GoogleImage[ GOOGLE_COVERINFO_LINK ] = ExtractCoverFromGoogleLink( GoogleImage[ 0 ] );
81
 
+            }
82
 
 
83
 
-        if( !GoogleImage[ GOOGLE_COVERINFO_LINK ].IsEmpty() )
84
 
-        {
85
 
-            CurImage.Add( GoogleImage[ GOOGLE_COVERINFO_LINK ] );
86
 
-            CurImage.Add( GoogleImage[ GOOGLE_COVERINFO_SIZE ] );
87
 
-            m_CoverLinks->Add( CurImage );
88
 
-            ImageIndex++;
89
 
-            if( ImageIndex == count )
90
 
-                break;
91
 
+            if( !GoogleImage[ GOOGLE_COVERINFO_LINK ].IsEmpty() )
92
 
+            {
93
 
+                CurImage.Add( GoogleImage[ GOOGLE_COVERINFO_LINK ] );
94
 
+                CurImage.Add( GoogleImage[ GOOGLE_COVERINFO_SIZE ] );
95
 
+                m_CoverLinks->Add( CurImage );
96
 
+                ImageIndex++;
97
 
+                if( ImageIndex == count )
98
 
+                    break;
99
 
+            }
100
 
         }
101
 
-
102
 
         //guLogMessage( wxT( "Pos: %u" ), StrPos );
103
 
     }
104
 
     return ImageIndex;
105
 
--- guayadeque.orig/src/Utils.cpp
106
 
+++ guayadeque/src/Utils.cpp
107
 
@@ -202,14 +202,6 @@ wxImage * guGetRemoteImage( const wxStri
108
 
                 }
109
 
             }
110
 
 
111
 
-            if( ResCode != 200 )
112
 
-            {
113
 
-                guLogMessage( wxT( "Error %u getting remote image '%s'\n%s" ),
114
 
-                    http.GetResponseCode(),
115
 
-                    url.c_str(),
116
 
-                    http.GetResponseHeader().c_str() );
117
 
-            }
118
 
-
119
 
             if( Buffer.IsOk() )
120
 
             {
121
 
                 wxMemoryInputStream Ins( Buffer );