Don't use shared pointers for cache

This commit is contained in:
Konstantinos Sideris 2018-05-08 20:30:09 +03:00
parent 4c4ea557b3
commit ebed87ea57
17 changed files with 86 additions and 96 deletions

View file

@ -453,12 +453,12 @@ TextInputWidget::TextInputWidget(QWidget *parent)
input_->setFixedHeight(textInputHeight);
});
connect(input_, &FilteredTextEdit::showSuggestions, this, [this](const QString &q) {
if (q.isEmpty() || cache_.isNull())
if (q.isEmpty() || !cache::client())
return;
QtConcurrent::run([this, q = q.toLower().toStdString()]() {
try {
emit input_->resultsRetrieved(cache_->searchUsers(
emit input_->resultsRetrieved(cache::client()->searchUsers(
ChatPage::instance()->currentRoom().toStdString(), q));
} catch (const lmdb::error &e) {
std::cout << e.what() << '\n';