Fix for airport search on some platforms.
Ensure the std::string passed to sqlite lives for the duration of the query.
This commit is contained in:
parent
fd248e9391
commit
fea8e96fe9
1 changed files with 2 additions and 2 deletions
|
@ -1750,13 +1750,13 @@ char** NavDataCache::searchAirportNamesAndIdents(const std::string& aFilter)
|
||||||
{
|
{
|
||||||
sqlite3_stmt_ptr stmt;
|
sqlite3_stmt_ptr stmt;
|
||||||
unsigned int numMatches = 0, numAllocated = 16;
|
unsigned int numMatches = 0, numAllocated = 16;
|
||||||
|
string searchTerm("%" + aFilter + "%");
|
||||||
if (aFilter.empty()) {
|
if (aFilter.empty()) {
|
||||||
stmt = d->getAllAirports;
|
stmt = d->getAllAirports;
|
||||||
numAllocated = 4096; // start much larger for all airports
|
numAllocated = 4096; // start much larger for all airports
|
||||||
} else {
|
} else {
|
||||||
stmt = d->searchAirports;
|
stmt = d->searchAirports;
|
||||||
string s = "%" + aFilter + "%";
|
sqlite_bind_stdstring(stmt, 1, searchTerm);
|
||||||
sqlite_bind_stdstring(stmt, 1, s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char** result = (char**) malloc(sizeof(char*) * numAllocated);
|
char** result = (char**) malloc(sizeof(char*) * numAllocated);
|
||||||
|
|
Loading…
Add table
Reference in a new issue