Bug 59250 - Crash when using file search and trying to copy all files found afterwards
Summary: Crash when using file search and trying to copy all files found afterwards
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash (vote)
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-06-02 13:34 UTC by Oliver Weber
Modified: 2003-06-02 20:57 UTC (History)
0 users

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 Oliver Weber 2003-06-02 13:34:50 UTC
Version:            (using KDE KDE 3.1.1a)
Installed from:    Compiled From Sources
Compiler:          gcc 2.95.3 
OS:          Linux

Konqueror crashes, when you do the following steps:

- Open 'Search files' from the 'Extras' menu
- Search files for example '*.txt' all other patterns work also. Include subfolders.
- Several files are found in several subfolders
- Choose 'Select All' from the 'Edit' menu
- Choose 'Copy' from the edit menu

The error was reproducable under kde 3.0.0 and under kde 3.1.1a
Comment 1 Waldo Bastian 2003-06-02 20:57:35 UTC
Subject: kdebase/libkonq

CVS commit by waba: 

CCMAIL: 59250-done@bugs.kde.org
Don't crash on copy without a currentItem() (BR59250)


  M +12 -4     konq_iconviewwidget.cc   1.240


--- kdebase/libkonq/konq_iconviewwidget.cc  #1.239:1.240
@@ -1087,11 +1087,10 @@ KonqIconDrag * KonqIconViewWidget::konqD
 
     KonqIconDrag * drag = new KonqIconDrag( dragSource );
-    // Position of the item clicked in the view
-    QPoint itempos = currentItem()->pixmapRect( FALSE ).topLeft();
-    // Set pixmap, with the correct offset
-    drag->setPixmap( *currentItem()->pixmap(), m_mousePos - itempos );
+    QIconViewItem *primaryItem = currentItem();
     // Append all items to the drag object
     for ( QIconViewItem *it = firstItem(); it; it = it->nextItem() ) {
         if ( it->isSelected() ) {
+          if (!primaryItem)
+             primaryItem = it;
           KURL url = (static_cast<KFileIVI *>(it))->item()->url();
           QString itemURL = KURLDrag::urlToString(url);
@@ -1107,4 +1106,13 @@ KonqIconDrag * KonqIconViewWidget::konqD
         }
     }
+
+    if (primaryItem)
+    {
+       // Position of the item clicked in the view
+       QPoint itempos = primaryItem->pixmapRect( FALSE ).topLeft();
+       // Set pixmap, with the correct offset
+       drag->setPixmap( *primaryItem->pixmap(), m_mousePos - itempos );
+    }
+
     return drag;
 }