[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] Segfault in wxDVC census manager
From: |
Vaclav Slavik |
Subject: |
Re: [lmi] Segfault in wxDVC census manager |
Date: |
Sun, 21 Aug 2011 11:18:07 +0200 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 |
Hi,
On 2011-08-18 17:08, Greg Chicares wrote:
> Without this curiously necessary step above:
> Census | Varying column width
> the segfault does not occur.
This is because the bug involves recalculation of column widths,
which was done too soon. I fixed the bug on wx trunk:
http://trac.wxwidgets.org/changeset/68792
http://trac.wxwidgets.org/changeset/68806
http://trac.wxwidgets.org/changeset/68807
I don't see any way to work around the bug in 2.9.2, unfortunately.
Here's a version of r68806 backported to 2.9.2:
---
src/generic/datavgen.cpp | 19 +++++++++----------
1 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp
index 44b0bd4..b795e2b 100644
--- a/src/generic/datavgen.cpp
+++ b/src/generic/datavgen.cpp
@@ -1952,13 +1952,12 @@ bool Walker( wxDataViewTreeNode * node, DoJob & func )
bool wxDataViewMainWindow::ItemAdded(const wxDataViewItem & parent, const
wxDataViewItem & item)
{
- GetOwner()->InvalidateColBestWidths();
-
if (IsVirtualList())
{
wxDataViewVirtualListModel *list_model =
(wxDataViewVirtualListModel*) GetOwner()->GetModel();
m_count = list_model->GetCount();
+ GetOwner()->InvalidateColBestWidths();
UpdateDisplay();
return true;
}
@@ -1986,6 +1985,7 @@ bool wxDataViewMainWindow::ItemAdded(const wxDataViewItem
& parent, const wxData
node->ChangeSubTreeCount(1);
m_count = -1;
+ GetOwner()->InvalidateColBestWidths();
UpdateDisplay();
return true;
@@ -1996,8 +1996,6 @@ static void DestroyTreeHelper( wxDataViewTreeNode * node);
bool wxDataViewMainWindow::ItemDeleted(const wxDataViewItem& parent,
const wxDataViewItem& item)
{
- GetOwner()->InvalidateColBestWidths();
-
if (IsVirtualList())
{
wxDataViewVirtualListModel *list_model =
@@ -2010,6 +2008,7 @@ bool wxDataViewMainWindow::ItemDeleted(const
wxDataViewItem& parent,
// TODO: why empty the entire selection?
m_selection.Empty();
+ GetOwner()->InvalidateColBestWidths();
UpdateDisplay();
return true;
@@ -2069,6 +2068,7 @@ bool wxDataViewMainWindow::ItemDeleted(const
wxDataViewItem& parent,
if( m_currentRow > GetRowCount() )
m_currentRow = m_count - 1;
+ GetOwner()->InvalidateColBestWidths();
UpdateDisplay();
return true;
@@ -2076,11 +2076,11 @@ bool wxDataViewMainWindow::ItemDeleted(const
wxDataViewItem& parent,
bool wxDataViewMainWindow::ItemChanged(const wxDataViewItem & item)
{
- GetOwner()->InvalidateColBestWidths();
-
SortPrepare();
g_model->Resort();
+ GetOwner()->InvalidateColBestWidths();
+
// Send event
wxWindow *parent = GetParent();
wxDataViewEvent le(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,
parent->GetId());
@@ -2108,8 +2108,6 @@ bool wxDataViewMainWindow::ValueChanged( const
wxDataViewItem & item, unsigned i
if (view_column == -1)
return false;
- GetOwner()->InvalidateColBestWidth(view_column);
-
// NOTE: to be valid, we cannot use e.g. INT_MAX - 1
/*#define MAX_VIRTUAL_WIDTH 100000
@@ -2122,6 +2120,8 @@ bool wxDataViewMainWindow::ValueChanged( const
wxDataViewItem & item, unsigned i
SortPrepare();
g_model->Resort();
+ GetOwner()->InvalidateColBestWidth(view_column);
+
// Send event
wxWindow *parent = GetParent();
wxDataViewEvent le(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,
parent->GetId());
@@ -2137,14 +2137,13 @@ bool wxDataViewMainWindow::ValueChanged( const
wxDataViewItem & item, unsigned i
bool wxDataViewMainWindow::Cleared()
{
- GetOwner()->InvalidateColBestWidths();
-
DestroyTree();
m_selection.Clear();
SortPrepare();
BuildTree( GetOwner()->GetModel() );
+ GetOwner()->InvalidateColBestWidths();
UpdateDisplay();
return true;
--
Regards,
Vaclav