mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-18 15:21:41 -05:00
Fix crash when deleting cached macro widgets
This commit is contained in:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user