mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-14 19:15:05 -05:00
fix texture corruption on ModsLayer
This commit is contained in:
parent
6e6daceb1c
commit
76e2ed47c6
3 changed files with 15 additions and 1 deletions
|
@ -643,6 +643,12 @@ void ModsLayer::onRefreshList(CCObject*) {
|
|||
}
|
||||
}
|
||||
void ModsLayer::onBack(CCObject*) {
|
||||
// Tell every list that we are about to exit the layer.
|
||||
// This prevents any page from being cached when the
|
||||
// cache invalidation event fires.
|
||||
for (auto& list : m_lists) {
|
||||
list.second->setIsExiting(true);
|
||||
}
|
||||
CCDirector::get()->replaceScene(CCTransitionFade::create(.5f, MenuLayer::scene(false)));
|
||||
|
||||
// To avoid memory overloading, clear caches after leaving the layer
|
||||
|
|
|
@ -415,6 +415,10 @@ void ModList::onPromise(ModListSource::PageLoadTask::Event* event) {
|
|||
}
|
||||
}
|
||||
|
||||
void ModList::setIsExiting(bool exiting) {
|
||||
m_exiting = true;
|
||||
}
|
||||
|
||||
void ModList::onPage(CCObject* sender) {
|
||||
// If no page count has been loaded yet, we can't do anything
|
||||
if (!m_source->getPageCount()) return;
|
||||
|
@ -470,7 +474,9 @@ void ModList::onCheckUpdates(typename server::ServerRequest<std::vector<std::str
|
|||
}
|
||||
|
||||
void ModList::onInvalidateCache(InvalidateCacheEvent* event) {
|
||||
this->gotoPage(0);
|
||||
if (!m_exiting) {
|
||||
this->gotoPage(0);
|
||||
}
|
||||
}
|
||||
|
||||
void ModList::activateSearch(bool activate) {
|
||||
|
|
|
@ -53,6 +53,7 @@ protected:
|
|||
EventListener<server::ServerRequest<std::vector<std::string>>> m_checkUpdatesListener;
|
||||
EventListener<server::ModDownloadFilter> m_downloadListener;
|
||||
bool m_bigSize = false;
|
||||
bool m_exiting = false;
|
||||
std::atomic<size_t> m_searchInputThreads = 0;
|
||||
|
||||
bool init(ModListSource* src, CCSize const& size);
|
||||
|
@ -83,4 +84,5 @@ public:
|
|||
void updateState();
|
||||
void updateSize(bool big);
|
||||
void activateSearch(bool activate);
|
||||
void setIsExiting(bool exiting);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue