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

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

From: Dave Page <dpage(at)pgadmin(dot)org>
To: Peter Geoghegan <peter(dot)geoghegan86(at)gmail(dot)com>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: wxWidgets 2.9 compatibility: Fix for sefault on table editor under GTK
Date: 2011-02-28 12:33:23
Message-ID: AANLkTi=g75MG22_EERMkC-p=mkYKgBWie_zg_3V+qwn=@mail.gmail.com (view raw or flat)
Thread:
Lists: pgadmin-hackers
Thanks - applied.

On Fri, Feb 25, 2011 at 8:31 PM, Peter Geoghegan
<peter(dot)geoghegan86(at)gmail(dot)com> wrote:
> 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
>
>
> --
> Sent via pgadmin-hackers mailing list (pgadmin-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>
>



-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

pgadmin-hackers by date

Next:From: Dave PageDate: 2011-02-28 13:36:00
Subject: pgAdmin III commit: Correctly identify the sys and dbo catalogs onPPAS
Previous:From: Dave PageDate: 2011-02-28 12:15:26
Subject: pgAdmin III commit: Fix the text edit grid control to work withwxWidge

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