- The exit overlay says which step of shutdown is running and what it waits on ("Stopping the OCR
scan: finishing the text lines it is reading.", the import, the viewer, the models), and how long
that step has taken once it passes 2 s. It said "Saving..." for all of it.
- OCR stops mid-batch: ocr_process takes a cancel flag (Ocr_Engine.cancel), checked by its workers
before each piece of work; a scan sets it to its own cancel. A cut-short batch stores nothing and
counts no failures. Closing during a scan took minutes when a batch held large images; now well
under a second.
- Once shutdown starts, the main thread stops running the app's frames (the viewer, search, import,
OCR, Stats) and draws only the overlay: background_frame read the search thread group while the
shutdown thread was tearing it down, an access violation on exit.
36 lines
1.5 KiB
Plaintext
36 lines
1.5 KiB
Plaintext
// A full-viewport overlay shown while app_exit_shutdown_start is running shutdown in the
|
|
// background (exit_shutdown.jai), so the window stays live and visibly busy instead of looking
|
|
// hung while the app finishes saving, with what it is waiting on.
|
|
|
|
app_exit_shutdown_overlay_ui :: () { using ImGui;
|
|
if !app_exit_shutdown_started() return;
|
|
|
|
text, elapsed, detail := app_exit_shutdown_status();
|
|
seconds := FormatFloat.{value = elapsed, trailing_width = 1, zero_removal = .NO};
|
|
label := tprint("%1 (%2 s)", text, seconds);
|
|
if detail label = tprint("%\n%", label, detail); // what it is waiting on
|
|
|
|
viewport := GetMainViewport();
|
|
draw_list := GetForegroundDrawList(viewport);
|
|
|
|
draw_list.AddRectFilled(draw_list, viewport.Pos, viewport.Pos + viewport.Size, GetColorU32(.{0, 0, 0, 0.55}));
|
|
|
|
padding := Vector2.{imgui_scale(18.0), imgui_scale(12.0)};
|
|
text_size := imgui_text_size(label);
|
|
box_size := text_size + 2 * padding;
|
|
box_min := Vector2.{
|
|
viewport.Pos.x + (viewport.Size.x - box_size.x) * 0.5,
|
|
viewport.Pos.y + (viewport.Size.y - box_size.y) * 0.5,
|
|
};
|
|
box_max := box_min + box_size;
|
|
|
|
background := GetStyleColorVec4(.PopupBg).*;
|
|
border := app_theme.palette.accent;
|
|
text_color := GetStyleColorVec4(.Text).*;
|
|
rounding := GetStyle().WindowRounding;
|
|
|
|
draw_list.AddRectFilled(draw_list, box_min, box_max, GetColorU32(background), rounding);
|
|
draw_list.AddRect(draw_list, box_min, box_max, GetColorU32(border), rounding, imgui_scale(1.5));
|
|
draw_list.AddText(draw_list, box_min + padding, GetColorU32(text_color), label);
|
|
}
|