Commit 1dd1fa2d authored by twanvl's avatar twanvl

Fixed crash in TextCtrl;

No longer ask to save set when it is still open in another window.
parent 16f41764
...@@ -74,6 +74,7 @@ void TextCtrl::setValue(const FakeTextValueP& value) { ...@@ -74,6 +74,7 @@ void TextCtrl::setValue(const FakeTextValueP& value) {
} }
void TextCtrl::onChangeSet() { void TextCtrl::onChangeSet() {
wxLogDebug(_("TextCtrl::onChangeSet %p"),this);
DataEditor::onChangeSet(); DataEditor::onChangeSet();
// initialize // initialize
if (viewers.empty()) { if (viewers.empty()) {
...@@ -109,6 +110,8 @@ void TextCtrl::onInit() { ...@@ -109,6 +110,8 @@ void TextCtrl::onInit() {
FOR_EACH_EDITOR { FOR_EACH_EDITOR {
e->onShow(true); e->onShow(true);
} }
// also init the DataEditor
DataEditor::onInit();
} }
void TextCtrl::onSize(wxSizeEvent&) { void TextCtrl::onSize(wxSizeEvent&) {
......
...@@ -437,14 +437,14 @@ void SetWindow::updateRecentSets() { ...@@ -437,14 +437,14 @@ void SetWindow::updateRecentSets() {
void SetWindow::onFileNew(wxCommandEvent&) { void SetWindow::onFileNew(wxCommandEvent&) {
if (!askSaveAndContinue()) return; if (isOnlyWithSet() && !askSaveAndContinue()) return;
// new set? // new set?
SetP new_set = new_set_window(this); SetP new_set = new_set_window(this);
if (new_set) setSet(new_set); if (new_set) setSet(new_set);
} }
void SetWindow::onFileOpen(wxCommandEvent&) { void SetWindow::onFileOpen(wxCommandEvent&) {
if (!askSaveAndContinue()) return; if (isOnlyWithSet() && !askSaveAndContinue()) return;
wxFileDialog dlg(this, _TITLE_("open set"), _(""), _(""), import_formats(), wxOPEN); wxFileDialog dlg(this, _TITLE_("open set"), _(""), _(""), import_formats(), wxOPEN);
if (dlg.ShowModal() == wxID_OK) { if (dlg.ShowModal() == wxID_OK) {
wxBusyCursor busy; wxBusyCursor busy;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment