Thread: PGAdmin Crashes when a column is dropped from a table (issue fix patch)
Hi Dave,
As per the issue reported in the pgadmin-support mailing about how pgAdmin crashes when a user drops either a column or a constraint of table, I tried reproducing the scenario at my end was able to reproduce it. While analyzing the issue I found that after a column or constraint is dropped, the table node gets refreshed twice; once due to an explicit call to frmMain::Refresh() in the frmMain::ExecDrop() function and second time due TreeItem selection change event which invokes frmMain::execSelChange(). Now in refresh we delete the object node of the table item and recreate it, which causes the segmentation fault.
Attached is the patch which fixes this issue. As per this fix I allow the Refesh() function to be called only once by setting m_refreshing variable to true before calling the first explicit refresh from ExecDrop() and then setting it back to false. With this the second Refresh() call is not made.
I have tested patch by setting Refresh on click to both: Refresh object on click and Refresh object and children on click in the UI Miscellaneous in the Setting dialog.
Let me know your view on this patch.
regards,
Dhiraj Chawla
Senior Software Engineer
EnterpriseDB Corporation
The Enterprise PostgreSQL Company
Phone: +91-20-30589522
Senior Software Engineer
EnterpriseDB Corporation
The Enterprise PostgreSQL Company
Phone: +91-20-30589522
Attachment
Thanks, patch applied for 1.18+. On Fri, Sep 20, 2013 at 12:48 PM, Dhiraj Chawla <dhiraj.chawla@enterprisedb.com> wrote: > Hi Dave, > > As per the issue reported in the pgadmin-support mailing about how pgAdmin > crashes when a user drops either a column or a constraint of table, I tried > reproducing the scenario at my end was able to reproduce it. While analyzing > the issue I found that after a column or constraint is dropped, the table > node gets refreshed twice; once due to an explicit call to > frmMain::Refresh() in the frmMain::ExecDrop() function and second time due > TreeItem selection change event which invokes frmMain::execSelChange(). Now > in refresh we delete the object node of the table item and recreate it, > which causes the segmentation fault. > > Attached is the patch which fixes this issue. As per this fix I allow the > Refesh() function to be called only once by setting m_refreshing variable to > true before calling the first explicit refresh from ExecDrop() and then > setting it back to false. With this the second Refresh() call is not made. > > I have tested patch by setting Refresh on click to both: Refresh object on > click and Refresh object and children on click in the UI Miscellaneous in > the Setting dialog. > > Let me know your view on this patch. > > > regards, > > Dhiraj Chawla > Senior Software Engineer > EnterpriseDB Corporation > The Enterprise PostgreSQL Company > > Phone: +91-20-30589522 -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Re: PGAdmin Crashes when a column is dropped from a table (issue fix patch)
From
Dhiraj Chawla
Date:
Thanks Dave.
regards,
Dhiraj Chawla
Senior Software Engineer
EnterpriseDB Corporation
The Enterprise PostgreSQL Company
Phone: +91-20-30589522
Senior Software Engineer
EnterpriseDB Corporation
The Enterprise PostgreSQL Company
Phone: +91-20-30589522
On Thu, Sep 26, 2013 at 7:47 PM, Dave Page <dpage@pgadmin.org> wrote:
Thanks, patch applied for 1.18+.--
On Fri, Sep 20, 2013 at 12:48 PM, Dhiraj Chawla
<dhiraj.chawla@enterprisedb.com> wrote:
> Hi Dave,
>
> As per the issue reported in the pgadmin-support mailing about how pgAdmin
> crashes when a user drops either a column or a constraint of table, I tried
> reproducing the scenario at my end was able to reproduce it. While analyzing
> the issue I found that after a column or constraint is dropped, the table
> node gets refreshed twice; once due to an explicit call to
> frmMain::Refresh() in the frmMain::ExecDrop() function and second time due
> TreeItem selection change event which invokes frmMain::execSelChange(). Now
> in refresh we delete the object node of the table item and recreate it,
> which causes the segmentation fault.
>
> Attached is the patch which fixes this issue. As per this fix I allow the
> Refesh() function to be called only once by setting m_refreshing variable to
> true before calling the first explicit refresh from ExecDrop() and then
> setting it back to false. With this the second Refresh() call is not made.
>
> I have tested patch by setting Refresh on click to both: Refresh object on
> click and Refresh object and children on click in the UI Miscellaneous in
> the Setting dialog.
>
> Let me know your view on this patch.
>
>
> regards,
>
> Dhiraj Chawla
> Senior Software Engineer
> EnterpriseDB Corporation
> The Enterprise PostgreSQL Company
>
> Phone: +91-20-30589522
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company