File rajceexport-stop-crashing-when-uploaded-nothing.patch of Package digikam

From: Jiri Slaby <jslaby@suse.cz>
Date: Thu, 15 Aug 2013 13:43:25 +0200
Subject: rajceexport: stop crashing when uploaded nothing
Patch-mainline: submitted on Aug 15 2013
References: bnc#835021

When we only open the window and immediately close it, we see:
0  QDir::fromNativeSeparators (pathName=...) at io/qdir.cpp:854
1  0x00007ffff6d7f077 in QUrl::fromLocalFile (localFile=...)
    at io/qurl.cpp:6260
2  0x00007fffce65f0f5 in KIPIRajceExportPlugin::RajceWidget::cancelUpload (
    this=0x197eb80)
    at /usr/src/debug/digikam-3.3.0/extra/kipi-plugins/rajceexport/rajcewidget.cpp:540
3  0x00007fffce66358d in KIPIRajceExportPlugin::RajceWindow::slotClose (
    this=0x1967e70)
    at /usr/src/debug/digikam-3.3.0/extra/kipi-plugins/rajceexport/rajcewindow.cpp:104
4  0x00007ffff6dd844f in QMetaObject::activate (sender=0x1967e70,
    m=<optimized out>, local_signal_index=<optimized out>, argv=0x0)
    at kernel/qobject.cpp:3556

It is because the iterator is not initialized yet. So check also
m_uploadingPhotos before checking the iterator to avoid that problem.

References: https://bugs.kde.org/show_bug.cgi?id=307689
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 rajceexport/rajcewidget.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/rajceexport/rajcewidget.cpp b/rajceexport/rajcewidget.cpp
index ff736af..1aca949 100644
--- a/rajceexport/rajcewidget.cpp
+++ b/rajceexport/rajcewidget.cpp
@@ -535,7 +535,8 @@ void RajceWidget::uploadNext()
 
 void RajceWidget::cancelUpload()
 {
-    if (m_currentUploadImage != m_uploadQueue.begin() && m_currentUploadImage != m_uploadQueue.end())
+    if (m_uploadingPhotos && m_currentUploadImage != m_uploadQueue.begin() &&
+        m_currentUploadImage != m_uploadQueue.end())
     {
         m_imgList->processed(KUrl::fromLocalFile(*m_currentUploadImage), false);
     }
-- 
1.8.3.4
openSUSE Build Service is sponsored by