| | |
| | | |
| | | MainWindowUI::~MainWindowUI() |
| | | { |
| | | // this->Hide(); |
| | | /* for (int i = 0; i < this->threads.size(); i++) |
| | | { |
| | | if (this->threads.at(i).joinable()) |
| | | { |
| | | this->threads.at(i).join(); |
| | | } |
| | | }*/ |
| | | if (this->modelLoaded) |
| | | { |
| | | free_sd_ctx(this->sd_ctx); |
| | | } |
| | | for (auto &t : this->threads) |
| | | { |
| | | t->join(); |
| | |
| | | { |
| | | this->sd_ctx = this->LoadModelv2(eventHandler, myItem); |
| | | this->currentModel = myItem.params.model_path; |
| | | this->currentVaeModel = myItem.params.vae_path; |
| | | } |
| | | else |
| | | { |
| | | if (myItem.params.model_path != this->currentModel) |
| | | if (myItem.params.model_path != this->currentModel || this->currentVaeModel != myItem.params.vae_path) |
| | | { |
| | | free_sd_ctx(this->sd_ctx); |
| | | this->sd_ctx = this->LoadModelv2(eventHandler, myItem); |
| | |
| | | myItem.params.controlnet_path.c_str(), |
| | | myItem.params.lora_model_dir.c_str(), |
| | | myItem.params.embeddings_path.c_str(), |
| | | true, false, false, |
| | | false, myItem.params.vae_tiling, false, |
| | | myItem.params.n_threads, |
| | | myItem.params.wtype, |
| | | myItem.params.rng_type, |
| | |
| | | wxQueueEvent(eventHandler, c); |
| | | this->modelLoaded = true; |
| | | this->currentModel = myItem.params.model_path; |
| | | this->currentVaeModel = myItem.params.vae_path; |
| | | } |
| | | return sd_ctx_; |
| | | } |