Bug 132081 - Critical: ShowFoto silently aborts saving image when closed
Summary: Critical: ShowFoto silently aborts saving image when closed
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Showfoto-Save (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR critical
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-08 20:18 UTC by Dik Takken
Modified: 2022-02-04 22:33 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 0.9.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dik Takken 2006-08-08 20:18:25 UTC
Version:           0.4.0 (using KDE KDE 3.5.3)
OS:                Linux

When you hit the 'save' button and close ShowFoto, the image is not always saved. The save operation is aborted when the user closes the application before the save is complete.
Comment 1 Marcel Wiesweg 2006-08-08 23:57:08 UTC
SVN commit 571245 by mwiesweg:

First part of a fix: Properly delete thread.

CCBUG: 132081


 M  +1 -0      dimginterface.cpp  


--- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas/dimginterface.cpp #571244:571245
@@ -167,6 +167,7 @@
 DImgInterface::~DImgInterface()
 {
     delete d->undoMan;
+    delete d->thread;
     delete d;
     m_instance = 0;
 }
Comment 2 Marcel Wiesweg 2006-08-09 23:17:37 UTC
SVN commit 571560 by mwiesweg:

When a save operation is runnnig, wait, show a message box and enter a loop.

- it would be better if the dialog shown does not have a OK button,
  but queuedMessageBox comes in very handy
- fix still missing for ImageWindow (IE), interfering with other local changes here

CCBUG: 132081



 M  +4 -0      showfoto/showfoto.cpp  
 M  +21 -2     utilities/imageeditor/editor/editorwindow.cpp  
 M  +1 -0      utilities/imageeditor/editor/editorwindow.h  


--- trunk/extragear/graphics/digikam/showfoto/showfoto.cpp #571559:571560
@@ -217,6 +217,10 @@
     if (!e)
         return;
 
+    // wait if a save operation is currently running
+    if (!waitForSavingToComplete())
+        return;
+
     if (m_currentItem && !promptUserSave(m_currentItem->url()))
         return;
 
--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/editorwindow.cpp #571559:571560
@@ -257,7 +257,7 @@
                                     actionCollection(), "editorwindow_print");
 
     m_fileDeleteAction = new KAction(i18n("Delete File"), "editdelete",
-                                     SHIFT+Key_Delete,
+                                     Key_Delete,
                                      this, SLOT(slotDeleteCurrentItem()),
                                      actionCollection(), "editorwindow_delete");
 
@@ -1025,7 +1025,7 @@
             // In this case, do not call enter_loop because exit_loop will not be called.
             if (saving)
             {
-                // Waiting asynchronous image file saving operation runing in separate thread.
+                // Waiting for asynchronous image file saving operation runing in separate thread.
                 m_savingContext->synchronizingState = SavingContextContainer::SynchronousSaving;
                 enter_loop();
                 m_savingContext->synchronizingState = SavingContextContainer::NormalSaving;
@@ -1050,6 +1050,25 @@
     return true;
 }
 
+bool EditorWindow::waitForSavingToComplete()
+{
+    // avoid reentrancy - return false means we have reentered the loop already.
+    if (m_savingContext->synchronizingState == SavingContextContainer::SynchronousSaving)
+        return false;
+
+    if (m_savingContext->savingState != SavingContextContainer::SavingStateNone)
+    {
+        // Waiting for asynchronous image file saving operation runing in separate thread.
+        m_savingContext->synchronizingState = SavingContextContainer::SynchronousSaving;
+        KMessageBox::queuedMessageBox(this,
+                                      KMessageBox::Information,
+                                      i18n("Please wait while the image is being saved..."));
+        enter_loop();
+        m_savingContext->synchronizingState = SavingContextContainer::NormalSaving;
+    }
+    return true;
+}
+
 void EditorWindow::enter_loop()
 {
     QWidget dummy(0, 0, WType_Dialog | WShowModal);
--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/editorwindow.h #571559:571560
@@ -126,6 +126,7 @@
     void loadImagePlugins();
 
     bool promptUserSave(const KURL& url);
+    bool waitForSavingToComplete();
     void startingSave(const KURL& url);
     bool startingSaveAs(const KURL& url);
     bool checkPermissions(const KURL& url);
Comment 3 Marcel Wiesweg 2006-08-13 14:52:39 UTC
SVN commit 572636 by mwiesweg:

Wait for saving to complete in ImageWindow as well

BUG: 132081 


 M  +4 -0      imagewindow.cpp  


--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/imagewindow.cpp #572635:572636
@@ -161,6 +161,10 @@
     if (!e)
         return;
 
+    // wait if a save operation is currently running
+    if (!waitForSavingToComplete())
+        return;
+
     if (!promptUserSave(m_urlCurrent))
         return;