Skip to content
Open
Changes from 3 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
d1c5eb7
Create the image-shrinking progress dialog on the UI thread (BL-16646)
StephenMcConnel Aug 5, 2026
fa179c2
Document the UI-thread requirement on UpdateImagesWithProgressDialog …
StephenMcConnel Aug 5, 2026
462f977
Merge remote-tracking branch 'origin/master' into BL-16646-HugeImageHang
StephenMcConnel Aug 5, 2026
2efd625
Report image-shrinking progress through IProgress instead of a dialog…
StephenMcConnel Aug 5, 2026
c2b96d0
Merge remote-tracking branch 'origin/master' into BL-16646-HugeImageHang
StephenMcConnel Aug 5, 2026
bb09b0d
Correct comments that still described the deleted progress dialog (BL…
StephenMcConnel Aug 5, 2026
7b14a6d
Reinstate the progress dialog for callers with no browser progress (B…
StephenMcConnel Aug 5, 2026
47ab0d5
Show the image-shrinking dialog only on the UI thread (BL-16646)
StephenMcConnel Aug 5, 2026
2be1adc
Use the caller's progress whenever there is a real one (BL-16646)
StephenMcConnel Aug 6, 2026
e8ccafa
Merge remote-tracking branch 'origin/master' into BL-16646-HugeImageHang
StephenMcConnel Aug 6, 2026
7b68fe0
Record why a UI-thread caller needs a pumping progress (BL-16646)
StephenMcConnel Aug 6, 2026
b686e89
Merge remote-tracking branch 'origin/master' into BL-16646-HugeImageHang
StephenMcConnel Aug 6, 2026
cc9ecf3
Log a failed image shrink instead of throwing out of the dialog (BL-1…
StephenMcConnel Aug 6, 2026
89427d4
Merge remote-tracking branch 'origin/master' into BL-16646-HugeImageHang
StephenMcConnel Aug 6, 2026
f81e1b8
Do not repeat a failed image shrink within the same update pass (BL-1…
StephenMcConnel Aug 6, 2026
8fc9fe9
Tell the user when shrinking a book's images fails (BL-16646)
StephenMcConnel Aug 6, 2026
4e03242
Merge remote-tracking branch 'origin/master' into BL-16646-HugeImageHang
StephenMcConnel Aug 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 38 additions & 9 deletions src/BloomExe/Book/BookStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4084,24 +4084,53 @@ public void MigrateToMediaLevel1ShrinkLargeImages()
}
else
{
using (var dlg = new ProgressDialogBackground())
// We may get invoked from a background thread, so we need to make sure we are on the UI thread
// before showing a dialog.
var shell = Shell.GetShellOrOtherOpenForm();
if (shell == null)
{
dlg.Text = "Updating Image Files";
dlg.ShowAndDoWork(
(progress, args) =>
ImageUtils.FixSizeAndTransparencyOfImagesInFolder(
FolderPath,
new List<string>(),
progress
)
// This shouldn't happen in normal operation, but just in case...
ImageUtils.FixSizeAndTransparencyOfImagesInFolder(
FolderPath,
new List<string>(),
new NullProgress()
);
}
else if (shell.InvokeRequired)
{
shell.Invoke(UpdateImagesWithProgressDialog);
Comment thread
StephenMcConnel marked this conversation as resolved.
Outdated
}
else
{
UpdateImagesWithProgressDialog();
}
}
}

Dom.UpdateMetaElement("mediaMaintenanceLevel", "1");
}

/// <summary>
/// Shrink any overlarge images (and remove any transparency) in the book folder, showing a
/// progress dialog while we work because it can be very slow. Must be called on the UI
/// thread: WinForms does not allow creating a Form anywhere else.
/// </summary>
private void UpdateImagesWithProgressDialog()
{
using (var dlg = new ProgressDialogBackground())
{
dlg.Text = "Updating Image Files";
dlg.ShowAndDoWork(
(progress, args) =>
ImageUtils.FixSizeAndTransparencyOfImagesInFolder(
FolderPath,
new List<string>(),
progress
)
);
}
}

private int GetMaintenanceLevel()
{
var levelString = Dom.GetMetaValue("maintenanceLevel", "0");
Expand Down