wxWidgets 2.9 compatibility: Fix for sefault on table editor under GTK - Mailing list pgadmin-hackers

From Peter Geoghegan
Subject wxWidgets 2.9 compatibility: Fix for sefault on table editor under GTK
Date
Msg-id AANLkTinfFZ4_td8OVhZCDkR8B+ASOgx5Nv1pFkXknuqU@mail.gmail.com
Whole thread Raw
Responses Re: wxWidgets 2.9 compatibility: Fix for sefault on table editor under GTK
Re: wxWidgets 2.9 compatibility: Fix for sefault on table editor under GTK
List 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

pgadmin-hackers by date:

Previous
From: Nikhil S
Date:
Subject: pgAdmin III: system schemas under incorrect hiearchy in EDBAS PostgreSQL mode
Next
From: Peter Geoghegan
Date:
Subject: Re: wxWidgets 2.9 compatibility: Fix for sefault on table editor under GTK