[Digikam-devel] [Bug 140417] Crash Digikam when delete image

Marcel Wiesweg marcel.wiesweg at gmx.de
Mon Jan 22 16:01:40 GMT 2007


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=140417         




------- Additional Comments From marcel.wiesweg gmx de  2007-01-22 17:01 -------
SVN commit 626246 by mwiesweg:

Give only ImageInfo copies to right side bar in main view.
We cannot well control the point when the original ImageInfos are deleted
in AlbumLister, so make sure that the side bar does not sit on invalid data.
This may be the cause for the crash in 140417 - please test if you can reproduce the crash.

CCBUG: 140417


 M  +2 -1      NEWS  
 M  +10 -3     digikam/albumiconview.cpp  
 M  +1 -1      digikam/albumiconview.h  
 M  +5 -2      digikam/digikamview.cpp  
 M  +5 -0      libs/imageproperties/imagepropertiessidebardb.cpp  
 M  +1 -0      libs/imageproperties/imagepropertiessidebardb.h  


--- trunk/extragear/graphics/digikam/NEWS #626245:626246
 @ -464,6 +464,7  @
 270 ==> 130237 : Typos in digiKam plugin files.
 271 ==> 138925 : External modules config dialog lacks a select all button.
 272 ==> 140038 : digiKam Image Editor crash on right click after changing toolbar.
-273 ==> 
+273 ==> 139766 : Crash when displaying EXIF metadata with Unicode comment
+274 ==> 
 
 ---------------------------------------------------------------------------------------------------- 
--- trunk/extragear/graphics/digikam/digikam/albumiconview.cpp #626245:626246
 @ -857,6 +857,9  @
     KIO::Job* job = DIO::del(urlList, useTrash);
     connect(job, SIGNAL(result(KIO::Job*)),
             this, SLOT(slotDIOResult(KIO::Job*)));
+
+    // The AlbumManager KDirWatch will trigger a DIO::scan.
+    // When this is completed, DIO will call AlbumLister::instance()->refresh().
 }
 
 void AlbumIconView::slotDeleteSelectedItemsDirectly(bool useTrash)
 @ -1391,7 +1394,7  @
     return itemList;
 }
 
-QPtrList<ImageInfo> AlbumIconView::selectedImageInfos() const
+QPtrList<ImageInfo> AlbumIconView::selectedImageInfos(bool copy) const
 {
     // Returns the list of ImageInfos of currently selected items,
     // with the extra feature that the currentItem is the first in the list.
 @ -1401,10 +1404,14  @
         AlbumIconItem *iconItem = static_cast<AlbumIconItem *>(it);
         if (it->isSelected())
         {
+            ImageInfo *info = iconItem->imageInfo();
+            if (copy)
+                info = new ImageInfo(*info);
+
             if (iconItem == currentItem())
-                list.prepend(iconItem->imageInfo());
+                list.prepend(info);
             else
-                list.append(iconItem->imageInfo());
+                list.append(info);
         }
     }
     return list;
--- trunk/extragear/graphics/digikam/digikam/albumiconview.h #626245:626246
 @ -81,7 +81,7  @
     KURL::List allItems();
     KURL::List selectedItems();
 
-    QPtrList<ImageInfo> selectedImageInfos() const;
+    QPtrList<ImageInfo> selectedImageInfos(bool copy) const;
 
     void refresh();
     void refreshItems(const KURL::List& itemList);
--- trunk/extragear/graphics/digikam/digikam/digikamview.cpp #626245:626246
 @ -621,12 +621,13  @
     d->selectionTimer->start(75, true);
 }
 
+
 void DigikamView::slotDispatchImageSelected()
 {
     if (d->needDispatchSelection)
     {
-        // the list of ImageInfos of currently selected items, currentItem first
-        QPtrList<ImageInfo> list = d->iconView->selectedImageInfos();
+        // the list of copies of ImageInfos of currently selected items, currentItem first
+        QPtrList<ImageInfo> list = d->iconView->selectedImageInfos(true );
 
         if (list.isEmpty())
         {
 @ -643,6 +644,8  @
                 AlbumIconItem *selectedItem = d->iconView->firstSelectedItem();
                 d->rightSideBar->setPreviousNextState(d->iconView->firstItem() != selectedItem,
                                                       d->iconView->lastItem() != selectedItem);
+                // we fed a list of copies
+                d->rightSideBar->takeImageInfoOwnership(true);
 
                 if (!d->albumWidgetStack->previewMode() == AlbumWidgetStack::PreviewAlbumMode)
                     d->albumWidgetStack->setPreviewItem(selectedItem->imageInfo()->kurl());
--- trunk/extragear/graphics/digikam/libs/imageproperties/imagepropertiessidebardb.cpp #626245:626246
 @ -182,7 +182,12  @
     slotChangedTab( getActiveTab() );
 }
 
+void ImagePropertiesSideBarDB::takeImageInfoOwnership(bool takeOwnership)
+{
+    d->currentInfos.setAutoDelete(takeOwnership);
+}
 
+
 void ImagePropertiesSideBarDB::slotNoCurrentItem(void)
 {
     ImagePropertiesSideBar::slotNoCurrentItem();
--- trunk/extragear/graphics/digikam/libs/imageproperties/imagepropertiessidebardb.h #626245:626246
 @ -68,6 +68,7  @
     virtual void itemChanged(QPtrList<ImageInfo> infos);
 
     void setPreviousNextState(bool hasPrevious, bool hasNext);
+    void takeImageInfoOwnership(bool takeOwnership);
 
     void populateTags(void);



More information about the Digikam-devel mailing list