libsyncevolution: load backends in function instead of constructor
Previously, backends were loaded in a constructor. At some point (*), that loading crashed with a segfault in the dynamic linker. To make debugging a bit easier and rule out non-determinism as the root cause of that crash, loading backends was moved into SyncContect::initMain(). (*) the crash happened when there were two backends which couldn't be loaded due to missing libraries and was related to error strings. A simpler test program did not trigger the problem, and now SyncEvolution has suitable backends for (hopefully?!) all platforms, so it no longer occurs, at least not during automated testing.
This commit is contained in:
parent
2ad9a45d45
commit
405ca882eb
|
@ -3257,6 +3257,9 @@ void SyncContext::initMain(const char *appname)
|
|||
SySync_ConsolePrintf = nopPrintf;
|
||||
}
|
||||
|
||||
// Load backends.
|
||||
SyncSource::backendsInit();
|
||||
|
||||
// invoke optional init parts, for example KDE KApplication init
|
||||
// in KDE backend
|
||||
GetInitMainSignal()(appname);
|
||||
|
|
|
@ -332,7 +332,7 @@ RegisterSyncSourceTest::RegisterSyncSourceTest(const string &configName, const s
|
|||
|
||||
static class ScannedModules {
|
||||
public:
|
||||
ScannedModules() {
|
||||
void init() {
|
||||
#ifdef ENABLE_MODULES
|
||||
list<pair <string, boost::shared_ptr<ReadDir> > > dirs;
|
||||
/* If enviroment variable SYNCEVOLUTION_BACKEND_DIR is set, will search
|
||||
|
@ -429,6 +429,10 @@ public:
|
|||
std::ostringstream debug, info;
|
||||
} scannedModules;
|
||||
|
||||
void SyncSource::backendsInit() {
|
||||
scannedModules.init();
|
||||
}
|
||||
|
||||
string SyncSource::backendsInfo() {
|
||||
return scannedModules.info.str();
|
||||
}
|
||||
|
|
|
@ -2124,6 +2124,13 @@ class SyncSource : virtual public SyncSourceBase, public SyncSourceConfig, publi
|
|||
static SyncSource *createTestingSource(const string &name, const string &type, bool error,
|
||||
const char *prefix = getenv("CLIENT_TEST_EVOLUTION_PREFIX"));
|
||||
|
||||
/**
|
||||
* Initialize and/or load backends. No longer
|
||||
* done automatically to give libsyncevolution
|
||||
* better control over when backends get loaded.
|
||||
*/
|
||||
static void backendsInit();
|
||||
|
||||
/**
|
||||
* Some information about available backends.
|
||||
* Multiple lines, formatted for users of the
|
||||
|
|
Loading…
Reference in New Issue