diff --git a/libgnucash/app-utils/gnc-optiondb-impl.hpp b/libgnucash/app-utils/gnc-optiondb-impl.hpp index 058f308be3..472b1ca24f 100644 --- a/libgnucash/app-utils/gnc-optiondb-impl.hpp +++ b/libgnucash/app-utils/gnc-optiondb-impl.hpp @@ -84,6 +84,7 @@ public: size_t num_sections() const noexcept { return m_sections.size(); } bool get_changed() const noexcept { return m_dirty; } void register_option(const char* section, GncOption&& option); + void register_option(const char* section, GncOption* option); void unregister_option(const char* section, const char* name); void set_default_section(const char* section); const GncOptionSection* const get_default_section() const noexcept; diff --git a/libgnucash/app-utils/gnc-optiondb.cpp b/libgnucash/app-utils/gnc-optiondb.cpp index 452e9e62a1..eae05d49b7 100644 --- a/libgnucash/app-utils/gnc-optiondb.cpp +++ b/libgnucash/app-utils/gnc-optiondb.cpp @@ -168,6 +168,13 @@ GncOptionDB::register_option(const char* sectname, GncOption&& option) m_sections.back()->add_option(std::move(option)); } +void +GncOptionDB::register_option(const char* sectname, GncOption* option) +{ + register_option(sectname, std::move(*option)); + delete option; +} + void GncOptionDB::unregister_option(const char* sectname, const char* name) { diff --git a/libgnucash/app-utils/gnc-optiondb.i b/libgnucash/app-utils/gnc-optiondb.i index e5cc556741..4aca8778ad 100644 --- a/libgnucash/app-utils/gnc-optiondb.i +++ b/libgnucash/app-utils/gnc-optiondb.i @@ -364,6 +364,11 @@ wrap_unique_ptr(GncOptionDBPtr, GncOptionDB); %ignore gnc_option_to_scheme; %ignore gnc_option_from_scheme; +/* GncOptionDB::register_option comes in GncOption* and GncOption&& + * overloads. The latter isn't useful to SWIG, ignore it. + */ +%ignore GncOptionDB::register_option(const char*, GncOption&&); + /* The following functions are overloaded in gnc-optiondb.hpp to provide both * GncOptionDB* and GncOptionDBPtr& versions. That confuses SWIG so ignore the * raw-ptr version.