mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Fix crash when deleting cached macro widgets
This commit is contained in:
parent
0736d673e1
commit
d9d387ad47
|
|
@ -56,9 +56,7 @@ MacroSegmentList::~MacroSegmentList()
|
|||
_autoScrollThread.join();
|
||||
}
|
||||
|
||||
for (const auto &[_, widgets] : _widgetCache) {
|
||||
clearWidgetVector(widgets);
|
||||
}
|
||||
ClearWidgetCache();
|
||||
}
|
||||
|
||||
static bool posIsInScrollbar(const QScrollBar *scrollbar, const QPoint &pos)
|
||||
|
|
@ -146,7 +144,6 @@ void MacroSegmentList::SetCachingEnabled(bool enable)
|
|||
void MacroSegmentList::CacheCurrentWidgetsFor(const Macro *macro)
|
||||
{
|
||||
if (!_useCache) {
|
||||
_widgetCache.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -168,7 +165,6 @@ void MacroSegmentList::CacheCurrentWidgetsFor(const Macro *macro)
|
|||
bool MacroSegmentList::PopulateWidgetsFromCache(const Macro *macro)
|
||||
{
|
||||
if (!_useCache) {
|
||||
_widgetCache.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -340,6 +336,13 @@ void MacroSegmentList::HideLastDropLine()
|
|||
_dropLineIdx = -1;
|
||||
}
|
||||
|
||||
void MacroSegmentList::ClearWidgetCache()
|
||||
{
|
||||
for (const auto &[_, widgets] : _widgetCache) {
|
||||
clearWidgetVector(widgets);
|
||||
}
|
||||
}
|
||||
|
||||
static bool isInUpperHalfOf(const QPoint &pos, const QRect &rect)
|
||||
{
|
||||
return QRect(rect.topLeft(),
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ private:
|
|||
bool IsInListArea(const QPoint &) const;
|
||||
QRect GetContentItemRectWithPadding(int idx) const;
|
||||
void HideLastDropLine();
|
||||
void ClearWidgetCache();
|
||||
|
||||
int _dragPosition = -1;
|
||||
int _dropLineIdx = -1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user