PING
On Tue, Jun 7, 2011 at 1:34 PM, David Coppa <[email protected]> wrote:
> Hi,
>
> The following patch fix a crash in QTreeView.
> It arrived too late to be pushed into this release...
>
> OK?
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/x11/qt4/Makefile,v
> retrieving revision 1.85
> diff -u -p -r1.85 Makefile
> --- Makefile 17 May 2011 08:26:53 -0000 1.85
> +++ Makefile 7 Jun 2011 11:28:11 -0000
> @@ -23,6 +23,7 @@ PKGNAME-debug = qt4-debug-${PKGVERSION}
> FULLPKGNAME-html = qt4-html-${PKGVERSION}
> FULLPKGPATH-html = ${BASE_PKGPATH},-html
>
> +REVISION-main = 0
> REVISION-tds = 0
>
> SHARED_LIBS = Qt3Support 8.0 \
> Index: patches/patch-src_gui_itemviews_qtreeview_cpp
> ===================================================================
> RCS file: patches/patch-src_gui_itemviews_qtreeview_cpp
> diff -N patches/patch-src_gui_itemviews_qtreeview_cpp
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_gui_itemviews_qtreeview_cpp 7 Jun 2011 11:28:11
> -0000
> @@ -0,0 +1,43 @@
> +$OpenBSD$
> +
> +Fix QTreeView crash in indexRowSizeHint/itemHeight
> +(http://bugreports.qt.nokia.com/browse/QTBUG-16292)
> +
> +--- src/gui/itemviews/qtreeview.cpp.orig Wed Mar 30 07:19:05 2011
> ++++ src/gui/itemviews/qtreeview.cpp Tue Jun 7 13:08:49 2011
> +@@ -2753,6 +2753,7 @@ int QTreeView::indexRowSizeHint(const QModelIndex &ind
> +
> + int start = -1;
> + int end = -1;
> ++ int indexRow = index.row();
> + int count = d->header->count();
> + bool emptyHeader = (count == 0);
> + QModelIndex parent = index.parent();
> +@@ -2789,7 +2790,7 @@ int QTreeView::indexRowSizeHint(const QModelIndex &ind
> + int logicalColumn = emptyHeader ? column :
> d->header->logicalIndex(column);
> + if (d->header->isSectionHidden(logicalColumn))
> + continue;
> +- QModelIndex idx = d->model->index(index.row(), logicalColumn,
> parent);
> ++ QModelIndex idx = d->model->index(indexRow, logicalColumn, parent);
> + if (idx.isValid()) {
> + QWidget *editor = d->editorForIndex(idx).editor;
> + if (editor && d->persistent.contains(editor)) {
> +@@ -3224,14 +3225,14 @@ int QTreeViewPrivate::itemHeight(int item) const
> + if (viewItems.isEmpty())
> + return 0;
> + const QModelIndex &index = viewItems.at(item).index;
> ++ if (!index.isValid())
> ++ return 0;
> + int height = viewItems.at(item).height;
> +- if (height <= 0 && index.isValid()) {
> ++ if (height <= 0) {
> + height = q_func()->indexRowSizeHint(index);
> + viewItems[item].height = height;
> + }
> +- if (!index.isValid() || height < 0)
> +- return 0;
> +- return height;
> ++ return qMax(height, 0);
> + }
> +
> +
>
>