From 126c3a3510a37e21c7404745144b5872b72aafdd Mon Sep 17 00:00:00 2001
From: Ferenc Szontágh <szf@fsociety.hu>
Date: Mon, 05 Feb 2024 18:52:50 +0000
Subject: [PATCH] deleted external prebuild stuffs, reload model if vae changed - otherwise the vae model not loading

---
 ui/MainWindowUI.cpp |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/ui/MainWindowUI.cpp b/ui/MainWindowUI.cpp
index 46ec1c6..abffbab 100644
--- a/ui/MainWindowUI.cpp
+++ b/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_;
 }

--
Gitblit v1.9.3