mirror of
https://github.com/polybar/polybar.git
synced 2026-03-04 07:19:15 +00:00
refactor: Use shared_ptr for Bar/Opts
This commit is contained in:
@ -28,21 +28,21 @@
|
||||
#endif
|
||||
|
||||
std::shared_ptr<Bar> bar;
|
||||
std::shared_ptr<Bar> &get_bar()
|
||||
std::shared_ptr<Bar> get_bar()
|
||||
{
|
||||
if (bar == nullptr)
|
||||
bar = std::make_shared<Bar>();
|
||||
return bar;
|
||||
}
|
||||
|
||||
const Options& bar_opts() {
|
||||
return *bar->opts.get();
|
||||
std::shared_ptr<Options> bar_opts() {
|
||||
return bar->opts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bar constructor
|
||||
*/
|
||||
Bar::Bar() : config_path(config::get_bar_path()), opts(std::make_unique<Options>())
|
||||
Bar::Bar() : config_path(config::get_bar_path()), opts(std::make_shared<Options>())
|
||||
{
|
||||
struct Options defaults;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user