| 110 | } |
| 111 | |
| 112 | fl::vector<JsonUiInternalPtr> JsonUiManager::getComponents() FL_NOEXCEPT { |
| 113 | fl::unique_lock<fl::mutex> lock(mMutex); |
| 114 | fl::vector<JsonUiInternalPtr> out; |
| 115 | for (auto &component : mComponents) { |
| 116 | if (auto ptr = component.lock()) { |
| 117 | out.push_back(ptr); |
| 118 | } else { |
| 119 | FL_WARN("*** WARNING: Component weak_ptr is expired, skipping"); |
| 120 | } |
| 121 | } |
| 122 | // Sort components by ID to ensure consistent serialization order |
| 123 | fl::sort(out.begin(), out.end(), [](const JsonUiInternalPtr& a, const JsonUiInternalPtr& b) FL_NOEXCEPT { |
| 124 | return a->id() < b->id(); |
| 125 | }); |
| 126 | return out; |
| 127 | } |
| 128 | |
| 129 | JsonUiInternalPtr JsonUiManager::findUiComponent(const char* id_or_name) FL_NOEXCEPT { |
| 130 | auto components = getComponents(); |