diff --git a/map/framework.cpp b/map/framework.cpp index 12ee82438c..0b43e6fc54 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -1070,7 +1070,9 @@ void FrameWork::AddRedrawCommandSure() string name; f.GetName(name); if (!name.empty() && name.find(m_text) != string::npos) - m_callback(name, f.GetLimitRect(16)); //@TODO hardcoded scale + { + m_callback(name, f.GetLimitRect(-1)); + } return true; } }; @@ -1078,8 +1080,12 @@ void FrameWork::AddRedrawCommandSure() template void FrameWork::Search(string const & text, SearchCallbackT callback) const { + threads::MutexGuard lock(m_modelSyn); SearchProcessor doClass(text, callback); - m_model.ForEachFeature(m_navigator.Screen().GlobalRect(), doClass); + m_model.ForEachFeatureWithScale(m2::RectD(MercatorBounds::minX, + MercatorBounds::minY, + MercatorBounds::maxX, + MercatorBounds::maxY), doClass, 9); } template class FrameWork; diff --git a/map/framework.hpp b/map/framework.hpp index 58f8cf3803..0be701d484 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -134,7 +134,7 @@ class FrameWork LocationRetrievedCallbackT m_locationObserver; location::State m_locationState; - threads::Mutex m_modelSyn; + mutable threads::Mutex m_modelSyn; void AddRedrawCommandSure(); void AddRedrawCommand(); diff --git a/qt/mainwindow.cpp b/qt/mainwindow.cpp index 75ecd03320..87c7ad48be 100644 --- a/qt/mainwindow.cpp +++ b/qt/mainwindow.cpp @@ -357,12 +357,17 @@ void MainWindow::OnSearchTextChanged(QString const & str) void MainWindow::OnSearchResult(string const & name, m2::RectD const & rect) { QTableWidget * table = static_cast(m_Docks[3]->widget()); - table->insertRow(0); + + int const rowCount = table->rowCount(); + if (rowCount > 100) + return; + + table->setRowCount(rowCount + 1); QTableWidgetItem * item = new QTableWidgetItem(QString::fromUtf8(name.c_str())); item->setData(Qt::UserRole, QRectF(QPointF(rect.minX(), rect.maxY()), QPointF(rect.maxX(), rect.minY()))); item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); - table->setItem(0, 0, item); + table->setItem(rowCount, 0, item); if (!m_Docks[3]->isVisible()) m_Docks[3]->show();