Don't fuckin call SetImage from the not UI thread wtf

This commit is contained in:
mid 2025-10-15 09:42:06 +03:00
parent 28e7fa3365
commit cc70d9138a

View File

@ -37,7 +37,13 @@ static int INJECTED_PREVIEW_FUNC(CHiPubNode *preview) {
CHiValue *val = CHi_Crawl(&preview->sinks[0]);
if(val->type == CUTIHI_VAL_SAMPLE && val->data.sample) {
float t = CHi_Time_Get(preview->ng);
globaldis->CallAfter([=](){
globaldis->viewer->SetImage(val->data.sample);
globaldis->timeline->Refresh();
globaldis->stba->SetStatusText(wxString::Format("%02i:%02i:%06.03fs", (int) (t / 3600), (int) (t / 60), fmodf(t, 60)));
});
}
return 1;
@ -301,21 +307,6 @@ Frame::Frame() : wxFrame(NULL, wxID_ANY, "Cuticle", wxDefaultPosition, {wxSystem
} else {
CHi_BeginCompilation(graph->backendNG);
toolbar.btnPerform->SetLabel("Kill");
std::thread{[=](){
while(graph->backendNG->compilationStatus == CUTIHI_COMP_RUNNING) {
CallAfter([=](){
float t = CHi_Time_Get(graph->backendNG);
stba->SetStatusText(wxString::Format("%02i:%02i:%06.03fs", (int) (t / 3600), (int) (t / 60), fmodf(t, 60)));
});
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
CallAfter([=](){
stba->SetStatusText("Compilation has ended.");
});
}}.detach();
}
});
@ -412,6 +403,9 @@ void Frame::LoadProject(std::string filename) {
auto tlba = ((Frame*) ng->ud)->tlba;
tlba->EnableTool(wxID_SAVE, true);
tlba->EnableTool(wxID_OPEN, true);
auto stba = ((Frame*) ng->ud)->stba;
stba->SetStatusText("Compilation has ended.");
});
};