From 7440ad2e6fe345d0fbc037c690913705bc351e68 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Fri, 19 Apr 2002 07:50:02 +0000 Subject: [PATCH] starting openbox without an rc file now works. it makes an empty Xrm db instead of crashing :) --- src/Resource.cc | 7 +++++++ src/Resource.h | 1 + src/openbox.cc | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Resource.cc b/src/Resource.cc index cff9bd38..2a678f89 100644 --- a/src/Resource.cc +++ b/src/Resource.cc @@ -85,6 +85,13 @@ bool Resource::load() { return true; } +void Resource::create() { + if (m_database != NULL) + XrmDestroyDatabase(m_database); + m_modified = false; + ASSERT(NULL != (m_database = XrmGetStringDatabase(""))); +} + void Resource::setValue(const std::string &rname, bool value) { ASSERT(m_database != NULL); diff --git a/src/Resource.h b/src/Resource.h index 726755f3..7d792494 100644 --- a/src/Resource.h +++ b/src/Resource.h @@ -50,6 +50,7 @@ public: void save(); bool load(); + void create(); void setValue(const std::string &rname, bool value); void setValue(const std::string &rname, int value); diff --git a/src/openbox.cc b/src/openbox.cc index dff68102..86baec6e 100644 --- a/src/openbox.cc +++ b/src/openbox.cc @@ -1001,7 +1001,7 @@ void Openbox::save() { void Openbox::load() { if (!config.load()) - return; + config.create(); std::string s; long l; -- 2.45.2