diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 755d5f286..50f1dca0d 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -491,7 +491,9 @@ void HistoryList::dragActionCancel() { historyWidget->noSelectingScroll(); } -void HistoryList::dragExec() { +void HistoryList::onDragExec() { + if (_dragAction != Dragging) return; + bool uponSelected = false; if (_dragItem) { bool afterDragSymbol; @@ -1168,6 +1170,7 @@ void HistoryList::leaveEvent(QEvent *e) { HistoryList::~HistoryList() { delete _menu; + _dragAction = NoDrag; } void HistoryList::adjustCurrent(int32 y) { @@ -1364,7 +1367,7 @@ void HistoryList::onUpdateSelected() { if (item != _dragItem || (m - _dragStartPos).manhattanLength() >= QApplication::startDragDistance()) { if (_dragAction == PrepareDrag) { _dragAction = Dragging; - dragExec(); + QTimer::singleShot(1, this, SLOT(onDragExec())); } else if (_dragAction == PrepareSelect) { _dragAction = Selecting; } diff --git a/Telegram/SourceFiles/historywidget.h b/Telegram/SourceFiles/historywidget.h index b14c50b82..e5204709c 100644 --- a/Telegram/SourceFiles/historywidget.h +++ b/Telegram/SourceFiles/historywidget.h @@ -59,7 +59,6 @@ public: void dragActionUpdate(const QPoint &screenPos); void dragActionFinish(const QPoint &screenPos, Qt::MouseButton button = Qt::LeftButton); void dragActionCancel(); - void dragExec(); void touchScrollUpdated(const QPoint &screenPos); QPoint mapMouseToItem(QPoint p, HistoryItem *item); @@ -107,6 +106,7 @@ public slots: void onMenuDestroy(QObject *obj); void onTouchSelect(); void onTouchScrollTimer(); + void onDragExec(); private: diff --git a/Telegram/SourceFiles/localstorage.cpp b/Telegram/SourceFiles/localstorage.cpp index 0426f2e1b..feafd3cc2 100644 --- a/Telegram/SourceFiles/localstorage.cpp +++ b/Telegram/SourceFiles/localstorage.cpp @@ -2458,7 +2458,7 @@ namespace Local { set.stickers.reserve(scnt); QMap read; - for (uint32 j = 0; j < scnt; ++j) { + for (int32 j = 0; j < scnt; ++j) { quint64 id, access; QString name, mime, alt; qint32 date, dc, size, width, height, type, typeOfSet; diff --git a/Telegram/SourceFiles/overviewwidget.cpp b/Telegram/SourceFiles/overviewwidget.cpp index 5b9400e57..2122ba6b5 100644 --- a/Telegram/SourceFiles/overviewwidget.cpp +++ b/Telegram/SourceFiles/overviewwidget.cpp @@ -486,7 +486,9 @@ void OverviewInner::dragActionFinish(const QPoint &screenPos, Qt::MouseButton bu _overview->updateTopBarSelection(); } -void OverviewInner::dragExec() { +void OverviewInner::onDragExec() { + if (_dragAction != Dragging) return; + bool uponSelected = false; if (_dragItem) { bool afterDragSymbol; @@ -936,7 +938,7 @@ void OverviewInner::onUpdateSelected() { if (_mousedItem != _dragItem || (m - _dragStartPos).manhattanLength() >= QApplication::startDragDistance()) { if (_dragAction == PrepareDrag) { _dragAction = Dragging; - dragExec(); + QTimer::singleShot(1, this, SLOT(onDragExec())); } else if (_dragAction == PrepareSelect) { _dragAction = Selecting; } @@ -1631,6 +1633,7 @@ void OverviewInner::showAll(bool recountHeights) { } OverviewInner::~OverviewInner() { + _dragAction = NoDrag; } OverviewWidget::OverviewWidget(QWidget *parent, const PeerData *peer, MediaOverviewType type) : QWidget(parent) diff --git a/Telegram/SourceFiles/overviewwidget.h b/Telegram/SourceFiles/overviewwidget.h index bad5d1dd4..f280f1ac8 100644 --- a/Telegram/SourceFiles/overviewwidget.h +++ b/Telegram/SourceFiles/overviewwidget.h @@ -44,7 +44,6 @@ public: void dragActionUpdate(const QPoint &screenPos); void dragActionFinish(const QPoint &screenPos, Qt::MouseButton button = Qt::LeftButton); void dragActionCancel(); - void dragExec(); void touchScrollUpdated(const QPoint &screenPos); QPoint mapMouseToItem(QPoint p, MsgId itemId, int32 itemIndex); @@ -89,6 +88,8 @@ public slots: void onTouchSelect(); void onTouchScrollTimer(); + void onDragExec(); + private: void fixItemIndex(int32 ¤t, MsgId msgId) const;