The unified diff between revisions [77e3623e..] and [395d2422..] is displayed below. It can also be downloaded as a raw diff.

This diff has been restricted to the following files: 'src/libstate.cpp'

#
#
# patch "src/libstate.cpp"
#  from [c26fe461401e2f9a86a5a6a04dd382258fda744c]
#    to [233c9231a05eae79ae231f8136850b43c34914d3]
#
============================================================
--- src/libstate.cpp	c26fe461401e2f9a86a5a6a04dd382258fda744c
+++ src/libstate.cpp	233c9231a05eae79ae231f8136850b43c34914d3
@@ -311,7 +311,6 @@ Config& Library_State::config() const
    {
    if(!config_obj)
       {
-      printf("Lazy creation of the global config\n");
       config_obj = new Config();
       config_obj->load_defaults();
       }
@@ -320,16 +319,23 @@ Config& Library_State::config() const
    }

 /*************************************************
-* Library_State Constructor                      *
+* Load a set of modules                          *
 *************************************************/
-Library_State::Library_State(const InitializerOptions& args,
-                             Modules& modules)
+void Library_State::initialize(const InitializerOptions& args,
+                               Modules& modules)
    {
+   if(mutex_factory)
+      throw Invalid_State("Library_State has already been initialized");
+
    if(args.thread_safe())
       mutex_factory = modules.mutex_factory();
    else
       mutex_factory = new Default_Mutex_Factory;

+   cached_default_allocator = 0;
+   x509_state_obj = 0;
+   ui = 0;
+
    timer = modules.timer();
    transcoder = modules.transcoder();

@@ -340,10 +346,6 @@ Library_State::Library_State(const Initi
    locks["allocator"] = get_mutex();
    locks["rng"] = get_mutex();
    locks["engine"] = get_mutex();
-   rng = 0;
-   cached_default_allocator = 0;
-   x509_state_obj = 0;
-   ui = 0;

    std::vector<Allocator*> mod_allocs = modules.allocators();
    for(u32bit j = 0; j != mod_allocs.size(); ++j)
@@ -379,6 +381,24 @@ Library_State::Library_State(const Initi
    }

 /*************************************************
+* Library_State Constructor                      *
+*************************************************/
+Library_State::Library_State()
+   {
+   mutex_factory = 0;
+
+   timer = 0;
+   config_obj = 0;
+   x509_state_obj = 0;
+
+   ui = 0;
+   transcoder = 0;
+   rng = 0;
+   cached_default_allocator = 0;
+   ui = 0;
+   }
+
+/*************************************************
 * Library_State Destructor                       *
 *************************************************/
 Library_State::~Library_State()