Summary: | Crash when deleting saved searches (GPS and Timeline) | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | Michael G. Hansen <mike> |
Component: | Searches-TimeLine | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | caulier.gilles, marcel.wiesweg |
Priority: | NOR | ||
Version: | 1.0.0 | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 1.0.0 | |
Sentry Crash Report: |
Description
Michael G. Hansen
2009-10-02 13:44:43 UTC
Works fine here... The crash seems to appear in your Qt installation? There is nothing wrong in the digiKam code, as far as I can see from the backtrace. You are using an 64bit system, maybe this is the reason? You are right, the crash does not occur in a 32-bit chroot. Is there a known issue with Qt on 64 bit systems related to this? But it does crash when run under valgrind in 32-bit mode (using beta4) and there are a lot of invalid reads and writes preceding the crash, as soon as I delete the album. SVN commit 1031092 by aclemens: When an album has been removed, set the search folder view to the current search again, otherwise we get crashes. A lot of album pointers in SearchFolderView still point to the currently deleted album, and since the album has been removed, we get a SegFault. For example: Save a search, remove it again. The line edit for editing the simple search keywords is still activated and you can enter a new keyword for the deleted search. Hit enter: boom. This is the backtrace Michael has posted here. The crashes / invalid reads reported by valgrind are something I don't understand. But you are right, it can crash any FolderSearchView (GPS, TimeLine, Search, FuzzySearch) etc. But how to reproduce, I can't say. It sometimes happens, sometimes not. Another problem: Create a search in GPS, call it 'aaa'. Create another search in Search, also call it 'aaa', you get a dialog that says that a search with this name already exists. Sure, behind the scenes all those searches are of one type, but for the normal user it is confusing when it reads "The search already exists" and he simply can't see it in the FolderView. Marcel, any idea how to fix this? In the meantime I will try to figure out how to crash GPSSearch with a defined "pattern". CCBUG:209207 M +2 -0 searchfolderview.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=1031092 I'm not able to crash it, Michael if you experience it again, can you tell us exactly what you did? Another problem: Rename a GPSSearch: it works, but the folderview will be completely empty. You have to restart digiKam to get it back. Michael, when using valgrind on a "debug" or "release" version of digiKam, I don't get the errors. Maybe valgrind is too confused with "debugfull" and it is best to run it on optimized code? (In reply to comment #5) > SVN commit 1031092 by aclemens: > Another problem: > Create a search in GPS, call it 'aaa'. > Create another search in Search, also call it 'aaa', you get a dialog that says > that a search with this name already exists. > Sure, behind the scenes all those searches are of one type, but for the normal > user it is confusing when it reads "The search already exists" and he simply > can't see it in the FolderView. How about prepending the search names with "GPS:", "Timeline:" etc. internally. When displayed in the corresponding tabs, the "GPS:" and "Timeline:" prefixes can be stripped, but when shown in a "My Searches" dialog, they get shown. (In reply to comment #7) > Michael, > > when using valgrind on a "debug" or "release" version of digiKam, I don't get > the errors. Maybe valgrind is too confused with "debugfull" and it is best to > run it on optimized code? I ran it on the version in 1.0.0-beta4 version in debian 32 bit, with debug symbols installed. But that was in a chroot, so maybe it does not work correctly there. I will try to crash the latest SVN again, but it currently does not compile. Okay, latest SVN (1031168): Could not crash it when run normally, only under Valgrind. Steps to reproduce: Timeline-> create searches a1, a2, a3, delete a2->crash. Valgrind log of 64-bit version after clicking "Yes" in delete confirmation: ==7256== Invalid read of size 8 ==7256== at 0x6740AD: Digikam::AlbumHistory::deleteAlbum(Digikam::Album*) (albumhistory.cpp:150) ==7256== by 0x6EFC17: Digikam::DigikamView::slotAlbumDeleted(Digikam::Album*) (digikamview.cpp:821) ==7256== by 0x6F8AE2: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:283) ==7256== by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112) ==7256== by 0x687E48: Digikam::AlbumManager::signalAlbumDeleted(Digikam::Album*) (albummanager.moc:222) ==7256== by 0x6884DE: Digikam::AlbumManager::deleteSAlbum(Digikam::SAlbum*) (albummanager.cpp:2356) ==7256== by 0x5F23EA: Digikam::TimeLineFolderView::searchDelete(Digikam::SAlbum*) (timelinefolderview.cpp:177) ==7256== by 0x5F32B1: Digikam::TimeLineFolderView::slotContextMenu(Q3ListViewItem*, QPoint const&, int) (timelinefolderview.cpp:273) ==7256== by 0x5F39DD: Digikam::TimeLineFolderView::qt_metacall(QMetaObject::Call, int, void**) (timelinefolderview.moc:93) ==7256== by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112) ==7256== by 0x6C73CA4: Q3ListView::contextMenuRequested(Q3ListViewItem*, QPoint const&, int) (moc_q3listview.cpp:372) ==7256== by 0x6B22DE4: Q3ListView::contentsContextMenuEvent(QContextMenuEvent*) (q3listview.cpp:4370) ==7256== Address 0x31ad9ed0 is 0 bytes inside a block of size 16 free'd ==7256== at 0x4C21ACE: operator delete(void*) (vg_replace_malloc.c:346) ==7256== by 0x6740D1: Digikam::AlbumHistory::deleteAlbum(Digikam::Album*) (albumhistory.cpp:152) ==7256== by 0x6EFC17: Digikam::DigikamView::slotAlbumDeleted(Digikam::Album*) (digikamview.cpp:821) ==7256== by 0x6F8AE2: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:283) ==7256== by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112) ==7256== by 0x687E48: Digikam::AlbumManager::signalAlbumDeleted(Digikam::Album*) (albummanager.moc:222) ==7256== by 0x6884DE: Digikam::AlbumManager::deleteSAlbum(Digikam::SAlbum*) (albummanager.cpp:2356) ==7256== by 0x5F23EA: Digikam::TimeLineFolderView::searchDelete(Digikam::SAlbum*) (timelinefolderview.cpp:177) ==7256== by 0x5F32B1: Digikam::TimeLineFolderView::slotContextMenu(Q3ListViewItem*, QPoint const&, int) (timelinefolderview.cpp:273) ==7256== by 0x5F39DD: Digikam::TimeLineFolderView::qt_metacall(QMetaObject::Call, int, void**) (timelinefolderview.moc:93) ==7256== by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112) ==7256== by 0x6C73CA4: Q3ListView::contextMenuRequested(Q3ListViewItem*, QPoint const&, int) (moc_q3listview.cpp:372) ==7256== ==7256== Invalid free() / delete / delete[] ==7256== at 0x4C21ACE: operator delete(void*) (vg_replace_malloc.c:346) ==7256== by 0x6740D1: Digikam::AlbumHistory::deleteAlbum(Digikam::Album*) (albumhistory.cpp:152) ==7256== by 0x6EFC17: Digikam::DigikamView::slotAlbumDeleted(Digikam::Album*) (digikamview.cpp:821) ==7256== by 0x6F8AE2: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:283) ==7256== by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112) ==7256== by 0x687E48: Digikam::AlbumManager::signalAlbumDeleted(Digikam::Album*) (albummanager.moc:222) ==7256== by 0x6884DE: Digikam::AlbumManager::deleteSAlbum(Digikam::SAlbum*) (albummanager.cpp:2356) ==7256== by 0x5F23EA: Digikam::TimeLineFolderView::searchDelete(Digikam::SAlbum*) (timelinefolderview.cpp:177) ==7256== by 0x5F32B1: Digikam::TimeLineFolderView::slotContextMenu(Q3ListViewItem*, QPoint const&, int) (timelinefolderview.cpp:273) ==7256== by 0x5F39DD: Digikam::TimeLineFolderView::qt_metacall(QMetaObject::Call, int, void**) (timelinefolderview.moc:93) ==7256== by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112) ==7256== by 0x6C73CA4: Q3ListView::contextMenuRequested(Q3ListViewItem*, QPoint const&, int) (moc_q3listview.cpp:372) ==7256== Address 0x31ad9ed0 is 0 bytes inside a block of size 16 free'd ==7256== at 0x4C21ACE: operator delete(void*) (vg_replace_malloc.c:346) ==7256== by 0x6740D1: Digikam::AlbumHistory::deleteAlbum(Digikam::Album*) (albumhistory.cpp:152) ==7256== by 0x6EFC17: Digikam::DigikamView::slotAlbumDeleted(Digikam::Album*) (digikamview.cpp:821) ==7256== by 0x6F8AE2: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:283) ==7256== by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112) ==7256== by 0x687E48: Digikam::AlbumManager::signalAlbumDeleted(Digikam::Album*) (albummanager.moc:222) ==7256== by 0x6884DE: Digikam::AlbumManager::deleteSAlbum(Digikam::SAlbum*) (albummanager.cpp:2356) ==7256== by 0x5F23EA: Digikam::TimeLineFolderView::searchDelete(Digikam::SAlbum*) (timelinefolderview.cpp:177) ==7256== by 0x5F32B1: Digikam::TimeLineFolderView::slotContextMenu(Q3ListViewItem*, QPoint const&, int) (timelinefolderview.cpp:273) ==7256== by 0x5F39DD: Digikam::TimeLineFolderView::qt_metacall(QMetaObject::Call, int, void**) (timelinefolderview.moc:93) ==7256== by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112) ==7256== by 0x6C73CA4: Q3ListView::contextMenuRequested(Q3ListViewItem*, QPoint const&, int) (moc_q3listview.cpp:372) ==7256== ==7256== Invalid read of size 1 ==7256== at 0x4C2410E: memmove (mc_replace_strmem.c:613) ==7256== by 0xB1465F8: QListData::remove(int) (qlistdata.cpp:218) ==7256== by 0xB14663A: QListData::erase(void**) (qlistdata.cpp:283) ==7256== by 0x675241: QList<Digikam::HistoryItem*>::erase(QList<Digikam::HistoryItem*>::iterator) (qlist.h:392) ==7256== by 0x674102: Digikam::AlbumHistory::deleteAlbum(Digikam::Album*) (albumhistory.cpp:153) ==7256== by 0x6EFC17: Digikam::DigikamView::slotAlbumDeleted(Digikam::Album*) (digikamview.cpp:821) ==7256== by 0x6F8AE2: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:283) ==7256== by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112) ==7256== by 0x687E48: Digikam::AlbumManager::signalAlbumDeleted(Digikam::Album*) (albummanager.moc:222) ==7256== by 0x6884DE: Digikam::AlbumManager::deleteSAlbum(Digikam::SAlbum*) (albummanager.cpp:2356) ==7256== by 0x5F23EA: Digikam::TimeLineFolderView::searchDelete(Digikam::SAlbum*) (timelinefolderview.cpp:177) ==7256== by 0x5F32B1: Digikam::TimeLineFolderView::slotContextMenu(Q3ListViewItem*, QPoint const&, int) (timelinefolderview.cpp:273) ==7256== Address 0x39bafa90 is 0 bytes after a block of size 128 alloc'd ==7256== at 0x4C222A8: realloc (vg_replace_malloc.c:476) ==7256== by 0xB1466BA: QListData::realloc(int) (qlistdata.cpp:111) ==7256== by 0xB1468DA: QListData::append() (qlistdata.cpp:131) ==7256== by 0x6751D2: QList<Digikam::HistoryItem*>::append(Digikam::HistoryItem* const&) (qlist.h:429) ==7256== by 0x675202: QList<Digikam::HistoryItem*>::push_back(Digikam::HistoryItem* const&) (qlist.h:266) ==7256== by 0x674702: Digikam::AlbumHistory::addAlbum(Digikam::Album*, QWidget*) (albumhistory.cpp:126) ==7256== by 0x6F843F: Digikam::DigikamView::slotAlbumSelected(Digikam::Album*) (digikamview.cpp:1175) ==7256== by 0x6F8B36: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:287) ==7256== by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112) ==7256== by 0x683D3C: Digikam::AlbumManager::signalAlbumCurrentChanged(Digikam::Album*) (albummanager.moc:242) ==7256== by 0x683D6F: Digikam::AlbumManager::setCurrentAlbum(Digikam::Album*) (albummanager.cpp:1632) ==7256== by 0x5F504C: Digikam::TimeLineView::createNewDateSearchAlbum(QString const&) (timelineview.cpp:462) ==7256== ==7256== Invalid read of size 1 ==7256== at 0x4C24100: memmove (mc_replace_strmem.c:613) ==7256== by 0xB1465F8: QListData::remove(int) (qlistdata.cpp:218) ==7256== by 0xB14663A: QListData::erase(void**) (qlistdata.cpp:283) ==7256== by 0x675241: QList<Digikam::HistoryItem*>::erase(QList<Digikam::HistoryItem*>::iterator) (qlist.h:392) ==7256== by 0x674102: Digikam::AlbumHistory::deleteAlbum(Digikam::Album*) (albumhistory.cpp:153) ==7256== by 0x6EFC17: Digikam::DigikamView::slotAlbumDeleted(Digikam::Album*) (digikamview.cpp:821) ==7256== by 0x6F8AE2: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:283) ==7256== by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112) ==7256== by 0x687E48: Digikam::AlbumManager::signalAlbumDeleted(Digikam::Album*) (albummanager.moc:222) ==7256== by 0x6884DE: Digikam::AlbumManager::deleteSAlbum(Digikam::SAlbum*) (albummanager.cpp:2356) ==7256== by 0x5F23EA: Digikam::TimeLineFolderView::searchDelete(Digikam::SAlbum*) (timelinefolderview.cpp:177) ==7256== by 0x5F32B1: Digikam::TimeLineFolderView::slotContextMenu(Q3ListViewItem*, QPoint const&, int) (timelinefolderview.cpp:273) ==7256== Address 0x39bafa91 is 1 bytes after a block of size 128 alloc'd ==7256== at 0x4C222A8: realloc (vg_replace_malloc.c:476) ==7256== by 0xB1466BA: QListData::realloc(int) (qlistdata.cpp:111) ==7256== by 0xB1468DA: QListData::append() (qlistdata.cpp:131) ==7256== by 0x6751D2: QList<Digikam::HistoryItem*>::append(Digikam::HistoryItem* const&) (qlist.h:429) ==7256== by 0x675202: QList<Digikam::HistoryItem*>::push_back(Digikam::HistoryItem* const&) (qlist.h:266) ==7256== by 0x674702: Digikam::AlbumHistory::addAlbum(Digikam::Album*, QWidget*) (albumhistory.cpp:126) ==7256== by 0x6F843F: Digikam::DigikamView::slotAlbumSelected(Digikam::Album*) (digikamview.cpp:1175) ==7256== by 0x6F8B36: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:287) ==7256== by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112) ==7256== by 0x683D3C: Digikam::AlbumManager::signalAlbumCurrentChanged(Digikam::Album*) (albummanager.moc:242) ==7256== by 0x683D6F: Digikam::AlbumManager::setCurrentAlbum(Digikam::Album*) (albummanager.cpp:1632) ==7256== by 0x5F504C: Digikam::TimeLineView::createNewDateSearchAlbum(QString const&) (timelineview.cpp:462) ==7256== ==7256== Invalid write of size 1 ==7256== at 0x4C24104: memmove (mc_replace_strmem.c:613) ==7256== by 0xB1465F8: QListData::remove(int) (qlistdata.cpp:218) ==7256== by 0xB14663A: QListData::erase(void**) (qlistdata.cpp:283) ==7256== by 0x675241: QList<Digikam::HistoryItem*>::erase(QList<Digikam::HistoryItem*>::iterator) (qlist.h:392) ==7256== by 0x674102: Digikam::AlbumHistory::deleteAlbum(Digikam::Album*) (albumhistory.cpp:153) ==7256== by 0x6EFC17: Digikam::DigikamView::slotAlbumDeleted(Digikam::Album*) (digikamview.cpp:821) ==7256== by 0x6F8AE2: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:283) ==7256== by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112) ==7256== by 0x687E48: Digikam::AlbumManager::signalAlbumDeleted(Digikam::Album*) (albummanager.moc:222) ==7256== by 0x6884DE: Digikam::AlbumManager::deleteSAlbum(Digikam::SAlbum*) (albummanager.cpp:2356) ==7256== by 0x5F23EA: Digikam::TimeLineFolderView::searchDelete(Digikam::SAlbum*) (timelinefolderview.cpp:177) ==7256== by 0x5F32B1: Digikam::TimeLineFolderView::slotContextMenu(Q3ListViewItem*, QPoint const&, int) (timelinefolderview.cpp:273) ==7256== Address 0x39bafa90 is 0 bytes after a block of size 128 alloc'd ==7256== at 0x4C222A8: realloc (vg_replace_malloc.c:476) ==7256== by 0xB1466BA: QListData::realloc(int) (qlistdata.cpp:111) ==7256== by 0xB1468DA: QListData::append() (qlistdata.cpp:131) ==7256== by 0x6751D2: QList<Digikam::HistoryItem*>::append(Digikam::HistoryItem* const&) (qlist.h:429) ==7256== by 0x675202: QList<Digikam::HistoryItem*>::push_back(Digikam::HistoryItem* const&) (qlist.h:266) ==7256== by 0x674702: Digikam::AlbumHistory::addAlbum(Digikam::Album*, QWidget*) (albumhistory.cpp:126) ==7256== by 0x6F843F: Digikam::DigikamView::slotAlbumSelected(Digikam::Album*) (digikamview.cpp:1175) ==7256== by 0x6F8B36: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:287) ==7256== by 0xB21E681: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3112) ==7256== by 0x683D3C: Digikam::AlbumManager::signalAlbumCurrentChanged(Digikam::Album*) (albummanager.moc:242) ==7256== by 0x683D6F: Digikam::AlbumManager::setCurrentAlbum(Digikam::Album*) (albummanager.cpp:1632) ==7256== by 0x5F504C: Digikam::TimeLineView::createNewDateSearchAlbum(QString const&) (timelineview.cpp:462) ==7256== ==7256== ==7256== More than 10000000 total errors detected. I'm not reporting any more. ==7256== Final error counts will be inaccurate. Go fix your program! ==7256== Rerun with --error-limit=no to disable this cutoff. Note ==7256== that errors may occur in your program without prior warning from ==7256== Valgrind, because errors are no longer being displayed. ==7256== KCrash: Application 'digikam' crashing... Unable to start Dr. Konqi --7256-- VALGRIND INTERNAL ERROR: Valgrind received a signal 11 (SIGSEGV) - exiting --7256-- si_code=1; Faulting address: 0x7; sp: 0x41336e080 valgrind: the 'impossible' happened: Killed by fatal signal ==7256== at 0x38035895: unlinkBlock (m_mallocfree.c:368) ==7256== by 0x38037780: vgPlain_arena_free (m_mallocfree.c:1517) ==7256== by 0x38001E91: die_and_free_mem (mc_malloc_wrappers.c:123) ==7256== by 0x38064768: vgPlain_scheduler (scheduler.c:1362) ==7256== by 0x38033E8D: final_tidyup (m_main.c:2581) ==7256== by 0x380341B3: shutdown_actions_NORETURN (m_main.c:2370) ==7256== by 0x3808D1C9: run_a_thread_NORETURN (syswrap-linux.c:146) ==7256== by 0x3808D22A: vgModuleLocal_start_thread_NORETURN (syswrap-linux.c:214) ==7256== by 0x3808F4BD: ??? (in /usr/lib/valgrind/memcheck-amd64-linux) ==7256== by 0xDEADBEEFDEADBEEE: ??? ==7256== by 0xDEADBEEFDEADBEEE: ??? ==7256== by 0xDEADBEEFDEADBEEE: ??? sched status: running_tid=4 Thread 4: status = VgTs_Runnable ==7256== at 0x4C21DBC: free (vg_replace_malloc.c:325) ==7256== by 0xBDAE5B8: ??? (in /lib/libc-2.9.so) ==7256== by 0xBDAE278: ??? (in /lib/libc-2.9.so) ==7256== by 0xBDAE981: ??? (in /lib/libc-2.9.so) ==7256== by 0x4A1E590: _vgnU_freeres (vg_preloaded.c:62) Yes, under valgrind it crashes, but I guess this is due to the fact that valgrind is too intrusive here. At least I use it with CGDB attached, this will crash it. When I do a normal memcheck, nothing crashes. I really don't understand these results, I checked all the variables and objects involved in it, but there is no null pointer or some other issue I can think of. But it always says: Invalid read of 4 at ==7256== Address 0x39bafa90 is 0 bytes after a block of size 128 alloc'd so something has been deleted at this address, right? > When an album has been removed, set the search folder view to the current > search again, otherwise we get crashes. > A lot of album pointers in SearchFolderView still point to the currently > deleted album, and since the album has been removed, we get a SegFault. > There is also the option of using an AlbumPointer<> in these cases. See albummanager.h at the bottom. > Another problem: > Create a search in GPS, call it 'aaa'. > Create another search in Search, also call it 'aaa', you get a dialog that says > that a search with this name already exists. > Sure, behind the scenes all those searches are of one type, but for the normal > > Marcel, > any idea how to fix this? Historically, we only had one type of searches, and this was all right. Now we have plenty of types, and indeed there is no need for unique names. We can be unique on type+name. This needs a change to all checkName() methods copy-and-pasted in the sidebars, and a change to createSAlbum in the AlbumManager. (In reply to comment #12) > I really don't understand these results, I checked all the variables and > objects involved in it, but there is no null pointer or some other issue I can > think of. But it always says: > Invalid read of 4 at > ==7256== Address 0x39bafa90 is 0 bytes after a block of size 128 alloc'd > > so something has been deleted at this address, right? Yes, seems to be. From Michael's log, as usual, the first problem should be fixed, which is in short: Invalid read of size 8: Digikam::AlbumHistory::deleteAlbum(Digikam::Album*) (albumhistory.cpp:150) Digikam::DigikamView::slotAlbumDeleted(Digikam::Album*) (digikamview.cpp:821) Digikam::AlbumManager::deleteSAlbum(Digikam::SAlbum*) (albummanager.cpp:2356) AlbumHistory looks like complex code that could be written much more readably with standard Qt containers... The question is: what is the problem? :) I attached valgrind to GDB and fiddled around, but there seems to be no error. When running without valgrind or gdb, everything seems to be fine though. (In reply to comment #6) > Another problem: > Rename a GPSSearch: it works, but the folderview will be completely empty. > You have to restart digiKam to get it back. Sorry I missed this message. I will try look into it this afternoon. Michael Do you want that i delay a little bit beta5 release ? I'm waiting a fix for this issue this week end, before to make tarball... Gilles (In reply to comment #16) > Do you want that i delay a little bit beta5 release ? > > I'm waiting a fix for this issue this week end, before to make tarball... > > Gilles I can't find the problem with the renamed albums right now, so go ahead ... Michael This problem is weird. As you can see in this trace, the item gets deleted twice: Invalid read of size 4 ==21813== at 0x822DCCC: Digikam::AlbumHistory::deleteAlbum(Digikam::Album*) (albumhistory.cpp:146) ==21813== by 0x82912A7: Digikam::DigikamView::slotAlbumDeleted(Digikam::Album*) (digikamview.cpp:822) ==21813== by 0x828B878: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:283) ==21813== by 0x6A0C8AB: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/libQtCore.so.4.5.3) ==21813== by 0x6A0D4E1: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib/libQtCore.so.4.5.3) ==21813== by 0x8233C7F: Digikam::AlbumManager::signalAlbumDeleted(Digikam::Album*) (albummanager.moc:222) ==21813== by 0x82424E9: Digikam::AlbumManager::deleteSAlbum(Digikam::SAlbum*) (albummanager.cpp:2356) ==21813== by 0x81C2A80: Digikam::GPSSearchFolderView::searchDelete(Digikam::SAlbum*) (gpssearchfolderview.cpp:184) ==21813== by 0x81C368E: Digikam::GPSSearchFolderView::slotContextMenu(Q3ListViewItem*, QPoint const&, int) (gpssearchfolderview.cpp:309) ==21813== by 0x81C1D49: Digikam::GPSSearchFolderView::qt_metacall(QMetaObject::Call, int, void**) (gpssearchfolderview.moc:95) ==21813== by 0x6A0C8AB: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/libQtCore.so.4.5.3) ==21813== by 0x6A0D4E1: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib/libQtCore.so.4.5.3) ==21813== Address 0x19b733d8 is 0 bytes inside a block of size 8 free'd ==21813== at 0x402322D: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==21813== by 0x822DCEC: Digikam::AlbumHistory::deleteAlbum(Digikam::Album*) (albumhistory.cpp:148) ==21813== by 0x82912A7: Digikam::DigikamView::slotAlbumDeleted(Digikam::Album*) (digikamview.cpp:822) ==21813== by 0x828B878: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:283) ==21813== by 0x6A0C8AB: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/libQtCore.so.4.5.3) ==21813== by 0x6A0D4E1: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib/libQtCore.so.4.5.3) ==21813== by 0x8233C7F: Digikam::AlbumManager::signalAlbumDeleted(Digikam::Album*) (albummanager.moc:222) ==21813== by 0x82424E9: Digikam::AlbumManager::deleteSAlbum(Digikam::SAlbum*) (albummanager.cpp:2356) ==21813== by 0x81C2A80: Digikam::GPSSearchFolderView::searchDelete(Digikam::SAlbum*) (gpssearchfolderview.cpp:184) ==21813== by 0x81C368E: Digikam::GPSSearchFolderView::slotContextMenu(Q3ListViewItem*, QPoint const&, int) (gpssearchfolderview.cpp:309) ==21813== by 0x81C1D49: Digikam::GPSSearchFolderView::qt_metacall(QMetaObject::Call, int, void**) (gpssearchfolderview.moc:95) ==21813== by 0x6A0C8AB: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/libQtCore.so.4.5.3) ==21813== ==21813== Invalid free() / delete / delete[] ==21813== at 0x402322D: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==21813== by 0x822DCEC: Digikam::AlbumHistory::deleteAlbum(Digikam::Album*) (albumhistory.cpp:148) ==21813== by 0x82912A7: Digikam::DigikamView::slotAlbumDeleted(Digikam::Album*) (digikamview.cpp:822) ==21813== by 0x828B878: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:283) ==21813== by 0x6A0C8AB: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/libQtCore.so.4.5.3) ==21813== by 0x6A0D4E1: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib/libQtCore.so.4.5.3) ==21813== by 0x8233C7F: Digikam::AlbumManager::signalAlbumDeleted(Digikam::Album*) (albummanager.moc:222) ==21813== by 0x82424E9: Digikam::AlbumManager::deleteSAlbum(Digikam::SAlbum*) (albummanager.cpp:2356) ==21813== by 0x81C2A80: Digikam::GPSSearchFolderView::searchDelete(Digikam::SAlbum*) (gpssearchfolderview.cpp:184) ==21813== by 0x81C368E: Digikam::GPSSearchFolderView::slotContextMenu(Q3ListViewItem*, QPoint const&, int) (gpssearchfolderview.cpp:309) ==21813== by 0x81C1D49: Digikam::GPSSearchFolderView::qt_metacall(QMetaObject::Call, int, void**) (gpssearchfolderview.moc:95) ==21813== by 0x6A0C8AB: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/libQtCore.so.4.5.3) ==21813== Address 0x19b733d8 is 0 bytes inside a block of size 8 free'd ==21813== at 0x402322D: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==21813== by 0x822DCEC: Digikam::AlbumHistory::deleteAlbum(Digikam::Album*) (albumhistory.cpp:148) ==21813== by 0x82912A7: Digikam::DigikamView::slotAlbumDeleted(Digikam::Album*) (digikamview.cpp:822) ==21813== by 0x828B878: Digikam::DigikamView::qt_metacall(QMetaObject::Call, int, void**) (digikamview.moc:283) ==21813== by 0x6A0C8AB: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/libQtCore.so.4.5.3) ==21813== by 0x6A0D4E1: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib/libQtCore.so.4.5.3) ==21813== by 0x8233C7F: Digikam::AlbumManager::signalAlbumDeleted(Digikam::Album*) (albummanager.moc:222) ==21813== by 0x82424E9: Digikam::AlbumManager::deleteSAlbum(Digikam::SAlbum*) (albummanager.cpp:2356) ==21813== by 0x81C2A80: Digikam::GPSSearchFolderView::searchDelete(Digikam::SAlbum*) (gpssearchfolderview.cpp:184) ==21813== by 0x81C368E: Digikam::GPSSearchFolderView::slotContextMenu(Q3ListViewItem*, QPoint const&, int) (gpssearchfolderview.cpp:309) ==21813== by 0x81C1D49: Digikam::GPSSearchFolderView::qt_metacall(QMetaObject::Call, int, void**) (gpssearchfolderview.moc:95) ==21813== by 0x6A0C8AB: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/libQtCore.so.4.5.3) When I remove the line albumhistory.cpp:148 (delete *iter), digiKam always crashes (or ends up in an infinite loop). If you use kDebug() to analyze the pointers, you can see that QList::erase() is NOT returning the next iter object pointer, but the current one. Why? I first thought this is an Qt 4.5.3 issue, but I wrote a small test app and in there it didn't happen. Valgrind will also state somewhere that AlbumHistory::addAlbum() is re-allocating memory when using QList::push_back() or QList::append(). I then thought that we might have a race condition and that AlbumHistory::addAlbum() is called while deleteAlbum is running and therefore make the iterator invalid. But this is not the case. So what is this? Why is erase() not working correctly here? I also made the stack lists normal objects instead of pointers, but it is not working. Any idea? This is a serious problem that will mostly all the time crash digiKam. There must be some simple explanation, but I can't find it at the moment. Andi
> If you use kDebug() to analyze the pointers, you can see that
> QList::erase() is NOT returning the next iter object pointer, but the current
> one.
> Why?
I will assume, until proven otherwise, that QList is working perfectly and our code is faulty ;-)
Is it returning the same iterator, or the same AlbumHistory pointer? In the latter case, probably, this pointer is added twice?
What about the idea of rewriting the class value-based around a QList<HistoryItem> or a QStack<HistoryItem>?
It is returning the same HistoryItem pointer. It is not added twice, I checked that. QList::erase() works perfectly fine in other code. It could be that addAlbum() is somehow called, but when I set a breakpoint in there, it is not executed when I delete a HistoryItem. This bug is killing me, I spent 5 hours in total now on it :D Weird thing, and without valgrind you will get no useful info at all, gdb is not detecting that the item has been already removed (invalid read of 4). I have extracted our code from AlbumHistory into a separate small app: http://digikam3rdparty.free.fr/misc.tarballs/temp/crashy.tar.gz If you compile it, you get the crash (and if you run valgrind you get the same errors as in digiKam). Now uncomment the "delete *iter" line, it will work. Question is: Are we doing something stupid here or is it a bug in Qt? When we DON'T delete the object that iter points to, it crashes (QList::erase() returns the same iterator object), but if we DO delete it, everything is fine? Weird! Andi SVN commit 1034433 by aclemens: Fix crash due to invalid iterator usage. I guess such fixes need to be done throughout the digiKam code base. BUG:209207 M +5 -9 albumhistory.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=1034433 |