diff --git a/src/db_accessors.h b/src/db_accessors.h index c065d62..e88708c 100644 --- a/src/db_accessors.h +++ b/src/db_accessors.h @@ -183,12 +183,15 @@ class sql_insert_name { ro::sql csql_into_names; ro::sql csql_namekey_into_keys; ro::sql csql_commit; + ro::sql csql_rollback; public: sql_insert_name(ISqlite3* p) : csql_begin(p, R"|(BEGIN;)|"), csql_into_names(p, R"|(INSERT OR ROLLBACK INTO "Names" VALUES(?1);)|"), csql_namekey_into_keys(p, R"|(INSERT OR ROLLBACK INTO "Keys" VALUES(?1, last_insert_rowid(), 1);)|"), - csql_commit(p, R"|(COMMIT;)|") {} + csql_commit(p, R"|(COMMIT;)|"), + csql_rollback(p, R"|(ROLLBACK;)|") + {} sql_insert_name(const std::unique_ptr& p) : sql_insert_name(p.get()) {} void operator()(const char* psz, const ristretto255::point& pt) { csql_begin.do_one(); @@ -197,7 +200,7 @@ public: csql_namekey_into_keys.do_one(pt); } catch (const std::exception & e) { - csql_commit.do_one(); + csql_rollback.do_one(); throw e; } csql_commit.do_one(); diff --git a/src/display_wallet.cpp b/src/display_wallet.cpp index 133f485..9430788 100644 --- a/src/display_wallet.cpp +++ b/src/display_wallet.cpp @@ -79,10 +79,10 @@ void display_wallet::close_menu_event_handler(wxCommandEvent& event) { void display_wallet::add_name_event_handler(wxCommandEvent& event) { wxTextEntryDialog dialog(this, - "This is a small sample\n" - "A long, long string to test out the text entrybox", - "Please enter a string", - "Default value", + R"("A Zooko name has a human readable name, +and a public key defined by the name and the wallet master secret)", + "Create a Zooko name", + "", wxOK | wxCANCEL); if (dialog.ShowModal() == wxID_OK) { diff --git a/src/frame.cpp b/src/frame.cpp index ad3731a..6bcac83 100644 --- a/src/frame.cpp +++ b/src/frame.cpp @@ -161,10 +161,17 @@ Frame::Frame(wxString wxs) } } catch (const std::exception& e) { + // if the attempt to load an existing wallet file fails, + // we have to complete startup somehow. + queue_error_message(e.what()); - panel = new welcome_to_rhocoin(this); //Owner is "this", via the base class wxFrame. m_panel is a - // non owning pointer in the derived class that duplicates the owning pointer in the base class. + panel = new welcome_to_rhocoin(this); //Owner is "this", via the base class wxFrame. } + // m_panel is a non owning pointer in the derived class that duplicates the + // owning pointer in the base class. This looks like a violation of DIY. + // but I have the concept of the primary child of the frame window, while + // wxWidgets lacks that concept. + // m_panel signifies the child window of the frame that currently matters. m_panel = panel; this->RestorePositionFromConfig(ClientToWindowSize(m_panel->GetBestSize())); SetClientSize(GetClientSize());