]> uap-core.de Git - note.git/commitdiff
fix wrong order in notebookmodel_detach, note_save must be called before detaching...
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Tue, 4 Mar 2025 14:03:09 +0000 (15:03 +0100)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Tue, 4 Mar 2025 14:03:09 +0000 (15:03 +0100)
application/note.c
application/notebook.c

index 84a613a5a6dbb6c77192cdf7975bab6b67a57fb8..09a9053c0f247415273c0b39eed8698c881d0006 100644 (file)
@@ -76,7 +76,10 @@ void note_load_content(UiObject *obj, NotebookModel *notebook, Note *note) {
 
 void note_save(UiObject *obj, NotebookModel *notebook, Note *note) {
     NoteModel *m = note->model;
+    printf("title obj: %s\n", m->title->obj);
+    
     char *title = ui_get(m->title);
+    printf("title: %s\n", title);
     char *content = ui_get(m->text);
     const CxAllocator *a = notebook->current_notes_pool->allocator;
     
index 895498adfe48575380de6d9ca7ec2ee6f0651889..8156d0bce93f950fdef94564258f294ba502d8cc 100644 (file)
@@ -75,14 +75,14 @@ void notebookmodel_attach(MainWindow *window, NotebookModel *model) {
 }
 
 void notebookmodel_detach(NotebookModel *model) {
+    if(model->current_note && model->current_note->model->modified) {
+        note_save(model->window->obj, model, model->current_note);
+    }
+    
     if(model->window) {
         ui_detach_document2(model->window->obj->ctx, model);
         model->window->current_notebook = NULL;
     }
-    
-    if(model->current_note && model->current_note->model->modified) {
-        note_save(model->window->obj, model, model->current_note);
-    }
 }
 
 void notebookmodel_set_collection(NotebookModel *model, Collection *collection) {