diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-08-29 17:17:30 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-08-29 17:17:30 +0300 |
commit | 7e0e97ee7ec31512731cbcef625a040266655062 (patch) | |
tree | 0a13c522c2c966056b3ebf5c9f948afac63a879c | |
parent | cb578a13379c828cfa02032ceab03a7dcbdb1c97 (diff) | |
download | plus-7e0e97ee7ec31512731cbcef625a040266655062.tar.gz plus-7e0e97ee7ec31512731cbcef625a040266655062.tar.bz2 plus-7e0e97ee7ec31512731cbcef625a040266655062.tar.xz plus-7e0e97ee7ec31512731cbcef625a040266655062.zip |
Call RsourceManager::cleanOrphans not on each resource get, but each 15 seconds.
-rw-r--r-- | src/gui/gui.cpp | 8 | ||||
-rw-r--r-- | src/gui/gui.h | 1 | ||||
-rw-r--r-- | src/resources/resourcemanager/resourcemanager.cpp | 1 |
3 files changed, 9 insertions, 1 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 66ada43b2..32f042ad2 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -140,6 +140,7 @@ Gui::Gui() : mForegroundColor(theme->getColor(ThemeColorId::TEXT, 255)), mForegroundColor2(theme->getColor(ThemeColorId::TEXT_OUTLINE, 255)), mTime(0), + mTime10(0), mCustomCursor(false), mDoubleClick(true) { @@ -352,6 +353,13 @@ void Gui::slowLogic() if (ipc) ipc->flush(); mTime = time; + + if (time > mTime10 || mTime10 - time > 10) + { + mTime10 = time + 10; + if (resourceManager) + resourceManager->cleanOrphans(); + } } BLOCK_END("Gui::slowLogic") diff --git a/src/gui/gui.h b/src/gui/gui.h index 9d42fcd3c..bbeced8d2 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -530,6 +530,7 @@ class Gui final Color mForegroundColor; Color mForegroundColor2; time_t mTime; + time_t mTime10; bool mCustomCursor; /**< Show custom cursor */ bool mDoubleClick; }; diff --git a/src/resources/resourcemanager/resourcemanager.cpp b/src/resources/resourcemanager/resourcemanager.cpp index 89e9a8bc6..5ecc58732 100644 --- a/src/resources/resourcemanager/resourcemanager.cpp +++ b/src/resources/resourcemanager/resourcemanager.cpp @@ -481,7 +481,6 @@ Resource *ResourceManager::get(const std::string &idPath, resource->mIdPath.c_str()); #endif mResources[idPath] = resource; - cleanOrphans(); } else { |