Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: dsp_config_manager::set_core_settings doesn't work on_quit() (Read 2879 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

dsp_config_manager::set_core_settings doesn't work on_quit()

Well, there is nothing more to say. Let me show it.
Code: [Select]
class inquit: public initquit
{
    void on_init()
    {
        // It does work here.
        // remove_one();
    }
    
    void on_quit()
    {
        // But it doesn't work here.
        // It looks like foobar doesn't save changes made with set_core_settings() on quitting.
        // remove_one();
    }

    void remove_one()
    {
        static_api_ptr_t<dsp_config_manager> manager;
        dsp_chain_config_impl chain;
        manager->get_core_settings(chain);
        chain.remove_item(0);
        manager->set_core_settings(chain);
    }
};

static initquit_factory_t<inquit> inquit_factory;
Is this a bug? Can this behavior be changed? Why? Thanks.

Quote
initialization order of components is undefined
This is probably the cause. Why not to make core services to be disposed after non-core ones?

dsp_config_manager::set_core_settings doesn't work on_quit()

Reply #1
I believe that settings always are persisted before on_quit. Typically one changes settings just in time so that autosave and other features work, not just when the app terminates.
Stay sane, exile.

dsp_config_manager::set_core_settings doesn't work on_quit()

Reply #2
The configuration of all components (including the core) is saved before the on_quit() handlers are called, so that a crash in an on_quit() handler cannot corrupt the configuration.

dsp_config_manager::set_core_settings doesn't work on_quit()

Reply #3
Another related question.

This code works pretty well everywhere, except it goes to exception on the third line in [de]constructor of my DSPs:
Quote
static_api_ptr_t<dsp_config_manager> manager;
dsp_chain_config_impl chain;
manager->get_core_settings(chain);

Why?

dsp_config_manager::set_core_settings doesn't work on_quit()

Reply #4
Which exception? Is the service supposed to be available at that point in time?
Also, it's "destructor". 
Stay sane, exile.

 

dsp_config_manager::set_core_settings doesn't work on_quit()

Reply #5
Yes, I think it should be available. An example point is between tracks.