Bug 293186 - Crash when arranging thumbnails
Summary: Crash when arranging thumbnails
Status: RESOLVED FIXED
Alias: None
Product: kphotoalbum
Classification: Applications
Component: Thumbnail Viewer (show other bugs)
Version: SVN trunk (KDE4 version)
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: KPhotoAlbum Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-03 05:50 UTC by Miika Turkia
Modified: 2012-02-04 14:04 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Miika Turkia 2012-02-03 05:50:34 UTC
Version:           SVN trunk (KDE4 version)
OS:                Linux

A crash occurs when selecting thumbnials with ctrl-clicking them and then dragging the selection to new location.

Reproducible: Always

Steps to Reproduce:
- view thumbnails
- select one thumbnail
- select the previous thumbnail while pressing ctrl key
- grab either of the selected images and drag it to different location
- answer yes if you are prompted whether you really want to do this

Actual Results:  
crash

Expected Results:  
All selected items to be moved to selected location without crashes (note that removing the Q_ASSERT prevents the crash but skip rearranging of some images)

This functionality expects the selection to be sorted. However, no sorting occurs when selecting individual images (the Qt documentation even states that the selection is not sorted). Thus the whole rearrangement is faulty if the selection happens to contain unordered items. And a Q_ASSERT ensures a crash.

Buggy code is in file XMLDB/Database.cpp and function
DB::ImageInfoList XMLDB::Database::takeImagesFromSelection

#10 0x00007f23dd124994 in qFatal(char const*, ...) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#11 0x000000000046c0d8 in XMLDB::Database::takeImagesFromSelection (this=0x2991d00, selection=...) at /opt/kpa/kpa-git/kphotoalbum/XMLDB/Database.cpp:398
#12 0x000000000046c212 in XMLDB::Database::reorder (this=0x2991d00, item=..., selection=..., after=true) at /opt/kpa/kpa-git/kphotoalbum/XMLDB/Database.cpp:368