Rearrange variables to finally fix distro_series segfault

main
Simon Quigley 3 days ago
parent bb71c5cdf8
commit dd8f41140f

@ -29,7 +29,7 @@ source_package_publishing_history::source_package_publishing_history()
lp(nullptr), lp(nullptr),
_distro_series(std::nullopt), _distro_series(std::nullopt),
distro_series([this]() -> std::optional<::distro_series> { distro_series([this]() -> std::optional<::distro_series> {
if (distro_series_link.empty()) return std::nullopt; if (!lp || distro_series_link.empty()) return std::nullopt;
if (_distro_series) return _distro_series; if (_distro_series) return _distro_series;
auto response = lp ? lp->api_get(distro_series_link) : std::nullopt; auto response = lp ? lp->api_get(distro_series_link) : std::nullopt;

@ -53,12 +53,14 @@ public:
std::string source_package_name; std::string source_package_name;
std::string source_package_version; std::string source_package_version;
void set_lp(launchpad* lp_ptr);
lazy_optional<::distro_series, std::function<std::optional<::distro_series>()>> distro_series;
private: private:
launchpad* lp; launchpad* lp;
std::optional<::distro_series> _distro_series = std::nullopt; std::optional<::distro_series> _distro_series = std::nullopt;
public:
void set_lp(launchpad* lp_ptr);
lazy_optional<::distro_series, std::function<std::optional<::distro_series>()>> distro_series;
}; };
#endif // SOURCE_PACKAGE_PUBLISHING_HISTORY #endif // SOURCE_PACKAGE_PUBLISHING_HISTORY

Loading…
Cancel
Save