[Patch] Crash in pgAdmin when Refresh object on click is enabled

From: Dhiraj Chawla <dhiraj(dot)chawla(at)enterprisedb(dot)com>
To: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: [Patch] Crash in pgAdmin when Refresh object on click is enabled
Date: 2012-11-08 13:12:34
Message-ID: CAJgtxT5bT7o-t26W9zo0fEa-0XJMeqXJ3_q9QZTARMAyBh8ByQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi Dave,

This patch fixes a crash in pgAdmin||| which happens when user enables
Refresh object on click in the options dialog in the UI Miscellaneous tab
and the opens the property dialog of Job, step or Schedule.

The reproduction step is as follows:

1. Enable Refresh object on click in Options dialog
2. Expand the Jobs node and open it's property dialog
3. Now click on Steps node or Schedules node or select a Step or Schedule
node which causes click refresh of the node.
4. Now again click on the Job node.
5. Now change some properties in the dialog and click ok.
6. pgAdmin crashes.

Similarly if you open a property dialog of a Step and then click on job
node and then change some properties in the dialog and then click Ok
button. Again the pgAdmin crashes.

The main reason found for the crash is, that when we select a Job, Step or
Schedule node, the node is refreshed in which case we delete object
associated with the node. Now this same object is passed to the dialog.
Thus when a dialog is invoked this object gets passed to the object which
is valid. But when we re-select this node, the node gets refreshed and the
object is deleted and a new object is created. Thus now the dialog has a
dereferenced object. Similarly if a parent node is selected the all the
child nodes are deleted.

This fix that I have done here in this patch, whenever we go to refresh a
node on single click we check if dialog of the currently selected node or
the nodes children to the current node are already opened or not. If no
dialogs are open we go ahead with the refresh or else we bail out.

Kindly review the patch and let me know if my approach is correct or not.

Thanks,

--
regards,

*Dhiraj Chawla*
Software Engineer
EnterpriseDB Corporation
The Enterprise PostgreSQL Company

Phone: +91-20-30589522

Attachment Content-Type Size
pgadmin_fix_crash_on_refresh_object_on_click.patch application/octet-stream 1.7 KB

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Dave Page 2012-11-08 15:20:55 pgAdmin III commit: Avoid updating the GQB model on every key press in
Previous Message Akshay Joshi 2012-11-08 11:03:52 Re: pgAdmin III commit: Fix dropping of constraints