Skip to content

std::bad_cast when reopening Shift Times with pt_BR locale after saving frame-based history (migration03) #212

Description

@Jef295

Summary

A std::bad_cast exception occurs when reopening Timing → Shift Times while using the Português (Brasil) (pt_BR) locale.

The crash is reproducible only after the dialog has been used to perform a frame-based shift greater than one frame. It does not occur when shifting by time.

This appears to be similar to issue #211, although the reproduction steps are different.


Environment

Executable

  • Aegisub-9794-migration03

Operating System

  • Windows 10 Pro 22H2

UI language

  • Português (Brasil) (pt_BR)

Steps to reproduce

  1. Delete shift_history.json.
  2. Start Aegisub.
  3. Open Timing → Shift Times.
  4. Under Shift by, select Frames.
  5. Enter a value greater than 1 (for example, 2).
  6. Click OK.
  7. Close the Shift Times dialog.
  8. Open Timing → Shift Times again.

Actual result

Aegisub throws:

std::bad_cast

and the dialog cannot be opened.


Expected result

The Shift Times dialog should reopen normally.


Additional observations

  • Shifting by 1 frame does not reproduce the issue.
  • Shifting by time does not reproduce the issue.
  • Deleting shift_history.json restores normal behavior until another frame-based shift (>1 frame) is saved.

Once the crash starts occurring:

  • pt_BR → ❌ Shift Times always crashes.
  • Switching the UI language to pt_PT (or another tested locale) → ✅ Shift Times opens normally.
  • Switching back to pt_BR without changing anything else → ❌ the crash immediately returns.

The executable, configuration, and shift_history.json remain exactly the same throughout these tests; only the selected UI language changes.


Investigation

All tests were performed using the same executable (Aegisub-9794-migration03).

Only the translation catalog or the selected UI language was changed.

Translation Result
Original pt_BR ❌ Crash
pt_PT ✅ Works
Other tested locales ✅ Work correctly
Modified pt_BR (plural entries removed) ✅ Works
Modified pt_BR (all translation entries preserved, workaround applied) ✅ Works

The workaround that avoids the crash displays the Shift Times history as:

Sem título, 10 frames trás, i+f, todas
Sem título, 3 frames trás, i+f, todas
Sem título, 2 frames trás, i+f, todas

Only the word "frames" remains untranslated; the rest of the history entry is still displayed in Portuguese.


Additional information

The same original pt_BR/aegisub.mo that consistently reproduces this issue on Aegisub-9794-migration03 does not reproduce the issue when used with:

  • Aegisub-9820-cibuilds-8165f1ad5

This report is specifically about the migration03 build. The comparison above is provided only as additional information.


Related issue

Possibly related to #211:

Crash (std::bad_cast) when opening "Shift Times" with zh_TW locale on migration03-02.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions