Initialise the read-only flag of the title block logo manager

TitleBlockTemplateLogoManager never sets read_only_: its constructor
leaves the member uninitialised, and setReadOnly() returns early when
the new value equals the member. The template editor calls
setReadOnly() right after creating the manager, so whenever the
garbage value happened to match, the call did nothing: the add, delete
and rename buttons stayed enabled on a read-only template, and
isReadOnly() returned garbage.

Give the member a default value, false, in the header, matching the
buttons' state after construction. Only
sources/titleblock/templatelogomanager.h changes.

No behaviour change for an editable template: setReadOnly(false) on a
manager that is already editable still returns early. No file-format
change.

Tests: none of their own; an uninitialised read is what a sanitizer
finds, and this one is the same kind as the BorderTitleBlock and
ConductorProfile fixes (#1358, #1359). ctest on macOS, and all
example projects through --resave and --export-svg, unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Beat Hangartner <beat@hangartners.ch>
This commit is contained in:
Beat Hangartner
2026-10-07 21:10:30 +02:00
parent ef795a21e5
commit 863c5e07ba
+1 -1
View File
@@ -73,6 +73,6 @@ class TitleBlockTemplateLogoManager : public QWidget {
QLabel *logo_type_; ///< current logo type
QDialogButtonBox *buttons_; ///< ok/cancel buttons
QDir open_dialog_dir_; ///< last opened directory
bool read_only_; ///< Whether this logo manager should allow logo edition (renaming, addition, deletion)
bool read_only_ = false; ///< Whether this logo manager should allow logo edition (renaming, addition, deletion)
};
#endif