From dc94a41a15af93d28310c04e224419fb033b7a7e Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 4 Oct 2014 18:27:03 -0500 Subject: [PATCH] Fix rare Konqueror crash in tree view mode This relates to Bug 1820 --- konqueror/listview/konq_listviewitems.cc | 2 ++ konqueror/listview/konq_listviewitems.h | 5 ++++- konqueror/listview/konq_treeviewitem.cc | 7 ++++++- konqueror/listview/konq_treeviewitem.h | 5 +++++ konqueror/listview/konq_treeviewwidget.cc | 4 ++-- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/konqueror/listview/konq_listviewitems.cc b/konqueror/listview/konq_listviewitems.cc index d5665313f..45ff99c1c 100644 --- a/konqueror/listview/konq_listviewitems.cc +++ b/konqueror/listview/konq_listviewitems.cc @@ -404,6 +404,7 @@ KonqBaseListViewItem::KonqBaseListViewItem(KonqBaseListViewWidget *_listViewWidg ,m_bDisabled(false) ,m_bActive(false) ,m_fileitem(_fileitem) +,m_fileitemURL(_fileitem->url()) ,m_pListViewWidget(_listViewWidget) {} @@ -413,6 +414,7 @@ KonqBaseListViewItem::KonqBaseListViewItem(KonqBaseListViewWidget *_listViewWidg ,m_bDisabled(false) ,m_bActive(false) ,m_fileitem(_fileitem) +,m_fileitemURL(_fileitem->url()) ,m_pListViewWidget(_listViewWidget) {} diff --git a/konqueror/listview/konq_listviewitems.h b/konqueror/listview/konq_listviewitems.h index f374daf1b..2e2827519 100644 --- a/konqueror/listview/konq_listviewitems.h +++ b/konqueror/listview/konq_listviewitems.h @@ -71,8 +71,11 @@ class KonqBaseListViewItem : public TDEListViewItem bool m_bDisabled; bool m_bActive; - /** Pointer to the file item in KDirLister's list */ + /** Pointer to the file item in KDirLister's list + * Don't use this unless you absolutely have to! */ KFileItem* m_fileitem; + /** URL of file item */ + KURL m_fileitemURL; /** Parent tree view */ KonqBaseListViewWidget* m_pListViewWidget; diff --git a/konqueror/listview/konq_treeviewitem.cc b/konqueror/listview/konq_treeviewitem.cc index 32baf1c41..12953c401 100644 --- a/konqueror/listview/konq_treeviewitem.cc +++ b/konqueror/listview/konq_treeviewitem.cc @@ -89,8 +89,13 @@ void KonqListViewDir::open( bool _open, bool _reload ) } } +KURL KonqListViewDir::kurl() +{ + return m_fileitemURL; +} + TQString KonqListViewDir::url( int _trailing ) { - return item()->url().url( _trailing ); + return m_fileitemURL.url( _trailing ); } diff --git a/konqueror/listview/konq_treeviewitem.h b/konqueror/listview/konq_treeviewitem.h index b17adacaf..6dcc1bb79 100644 --- a/konqueror/listview/konq_treeviewitem.h +++ b/konqueror/listview/konq_treeviewitem.h @@ -66,6 +66,11 @@ public: */ virtual void setComplete( bool _b ) { m_bComplete = _b; } + /** + * URL of this directory + */ + KURL kurl(); + /** * URL of this directory * @param _trailing set to true for a trailing slash (see KURL) diff --git a/konqueror/listview/konq_treeviewwidget.cc b/konqueror/listview/konq_treeviewwidget.cc index 4d04f2fa4..77adc4b61 100644 --- a/konqueror/listview/konq_treeviewwidget.cc +++ b/konqueror/listview/konq_treeviewwidget.cc @@ -294,13 +294,13 @@ void KonqTreeViewWidget::slotDeleteItem( KFileItem *_fileItem ) void KonqTreeViewWidget::openSubFolder( KonqListViewDir* _dir, bool _reload ) { - m_dirLister->openURL( _dir->item()->url(), true /* keep existing data */, _reload ); + m_dirLister->openURL( _dir->kurl(), true /* keep existing data */, _reload ); slotUpdateBackground(); } void KonqTreeViewWidget::stopListingSubFolder( KonqListViewDir* _dir ) { - m_dirLister->stop( _dir->item()->url() ); + m_dirLister->stop( _dir->kurl() ); slotUpdateBackground(); }