wxWidgets based Stable Diffusion C++ GUi
Ferenc Szontágh
2024-02-05 126c3a3510a37e21c7404745144b5872b72aafdd
ui/MainWindowUI.cpp
@@ -449,14 +449,10 @@
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();
@@ -488,10 +484,11 @@
    {
        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);
@@ -995,7 +992,7 @@
        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,
@@ -1017,6 +1014,7 @@
        wxQueueEvent(eventHandler, c);
        this->modelLoaded = true;
        this->currentModel = myItem.params.model_path;
        this->currentVaeModel = myItem.params.vae_path;
    }
    return sd_ctx_;
}