Skip site navigation (1) Skip section navigation (2)

wxWidgets 2.9 compatibility: Fix for sefault on table editor under GTK

From: Peter Geoghegan <peter(dot)geoghegan86(at)gmail(dot)com>
To: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: wxWidgets 2.9 compatibility: Fix for sefault on table editor under GTK
Date: 2011-02-25 20:31:14
Message-ID: AANLkTinfFZ4_td8OVhZCDkR8B+ASOgx5Nv1pFkXknuqU@mail.gmail.com (view raw or flat)
Thread:
Lists: pgadmin-hackers
I should have spotted this one sooner, but I was thrown off by the
fact that my sqlGridTextEditor code (inherits wxGridCellTextEditor)
compiled without having appropriate EndEdit()/ApplyEdit() signature
changes. sqlGridBoolEditor (inherits from wxGridCellEditor), on the
other hand, made ApplyEdit and EndEdit() with the new signature pure
to avoid this problem. I've reported the inconsistency to wx-users.

Attached patch fixes segfault, and makes us consistent with this
design principle of 2.9 for grid cells, from wx docs:

virtual bool wxGridCellEditor::EndEdit	(	int 	row,
int 	col,
const wxGrid * 	grid,
const wxString & 	oldval,
wxString * 	newval	
)			 [pure virtual]
End editing the cell.
This function must check if the current value of the editing control
is valid and different from the original value (available as oldval in
its string form and possibly saved internally using its real type by
BeginEdit()). If it isn't, it just returns false, otherwise it must do
the following: # Save the new value internally so that ApplyEdit()
could apply it. # Fill newval (which is never NULL) with the string
representation of the new value. # Return true

****Notice that it must not modify the grid as the change could still
be vetoed.****

I've made sqlGridNumericEditor do the same, even though it was
ostensibly well behaved before, because changes could still be vetoed
before we get to ApplyEdit(). Naturally, 2.8 compatibility is
preserved.

I've also updated the build shell script to remove contrib/OGL stuff,
which we no longer need regardless of wx version.

BTW, the comment "// pure virtual in wx 2.9+, doesn't exist in prior
versions" isn't currently true for wxGridCellTextEditor inheriting
classes, but I left it there in anticipation of it becoming true and
for consistency with sqlGridBoolEditor.

-- 
Regards,
Peter Geoghegan

Attachment: applyedit_table.patch
Description: text/x-patch (4.2 KB)

Responses

pgadmin-hackers by date

Next:From: Peter GeogheganDate: 2011-02-26 20:21:33
Subject: Re: wxWidgets 2.9 compatibility: Fix for sefault on table editor under GTK
Previous:From: Nikhil SDate: 2011-02-25 15:05:51
Subject: pgAdmin III: system schemas under incorrect hiearchy in EDBAS PostgreSQL mode

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group