Fix segfault when opening recent file with pattern sync; Don't show p… (#2448)

…attern selection popup when pattern is already open

This PR does two things. Most importantly, it fixes a segfault that can
be caused by opening a recent file with pattern sync enabled.
Secondly, it makes it so that the pattern selection popup does not
appear if you already have text in the pattern editor for a given
provider (due to CLI args, a project file, pattern sync, etc.). If you
open a file normally, that text field is empty and the popup will appear
so you can select a pre-made pattern like usual.
This commit is contained in:
Zackary Newman
2025-09-14 00:10:38 -04:00
committed by GitHub
parent f08b182bf2
commit 67efea6444
4 changed files with 110 additions and 82 deletions

View File

@@ -40,8 +40,12 @@ namespace hex::plugin::builtin {
return &m_editorRuntime;
}
ui::TextEditor &getTextEditor() {
return m_textEditor;
ui::TextEditor *getTextEditor() {
auto provider = ImHexApi::Provider::get();
if (provider == nullptr)
return nullptr;
return &m_textEditor.get(provider);
}
bool getChangesWereParsed() const {