Re: pgadmin3-1.6.1 - core dumped - Work around - Mailing list pgadmin-hackers

From Dave Page
Subject Re: pgadmin3-1.6.1 - core dumped - Work around
Date
Msg-id 4582754A.2060502@postgresql.org
Whole thread Raw
In response to Re: pgadmin3-1.6.1 - core dumped - Work around  (Zdenek Kotala <Zdenek.Kotala@Sun.COM>)
Responses Re: pgadmin3-1.6.1 - core dumped - Work around  (Dhanaraj M <Dhanaraj.M@Sun.COM>)
wxWidgets/pgAdmin3 conforms to section 508 accessibility requirements?  (Dhanaraj M <Dhanaraj.M@Sun.COM>)
List pgadmin-hackers
Zdenek Kotala wrote:
>> I'm still not sure how you're getting into that code when you close
>> the form though...
>
> The root cause is destructor of frmQuery dialog. It removes all
> connection from combo box exclude last item - "new connection". Each
> deletion invoke frmQuery::OnChangeConnection event and the
> OnChangeConnection method invokes "new connection dialog" in the last
> step. And because there are some empty combo boxes on this dialog, gtk
> generates core.

Ah, of course - well spotted.

> My suggestion is disable event generation for cbConnection in the
> destructor.

Agreed. Can one or both of you test the attached patch please?

Thanks, Dave.
Index: frmQuery.cpp
===================================================================
--- frmQuery.cpp    (revision 5791)
+++ frmQuery.cpp    (working copy)
@@ -62,7 +62,6 @@
 BEGIN_EVENT_TABLE(frmQuery, pgFrame)
     EVT_ERASE_BACKGROUND(           frmQuery::OnEraseBackground)
     EVT_SIZE(                       frmQuery::OnSize)
-    EVT_COMBOBOX(CTRLID_CONNECTION, frmQuery::OnChangeConnection)
     EVT_CLOSE(                      frmQuery::OnClose)
     EVT_SET_FOCUS(                  frmQuery::OnSetFocus)
     EVT_MENU(MNU_NEW,               frmQuery::OnNew)
@@ -280,6 +279,7 @@
     outputPane->AddPage(msgResult, _("Messages"));
     outputPane->AddPage(msgHistory, _("History"));

+    this->Connect(CTRLID_CONNECTION, wxEVT_COMMAND_COMBOBOX_SELECTED,
wxCommandEventHandler(frmQuery::OnChangeConnection));
     sqlQuery->Connect(wxID_ANY, wxEVT_SET_FOCUS,wxFocusEventHandler(frmQuery::OnFocus));
     sqlResult->Connect(wxID_ANY, wxEVT_SET_FOCUS, wxFocusEventHandler(frmQuery::OnFocus));
     msgResult->Connect(wxID_ANY, wxEVT_SET_FOCUS, wxFocusEventHandler(frmQuery::OnFocus));
@@ -369,6 +369,7 @@
     sqlResult->Disconnect(wxID_ANY, wxEVT_SET_FOCUS, wxFocusEventHandler(frmQuery::OnFocus));
     msgResult->Disconnect(wxID_ANY, wxEVT_SET_FOCUS, wxFocusEventHandler(frmQuery::OnFocus));
     msgHistory->Disconnect(wxID_ANY, wxEVT_SET_FOCUS, wxFocusEventHandler(frmQuery::OnFocus));
+    this->Disconnect(CTRLID_CONNECTION, wxEVT_COMMAND_COMBOBOX_SELECTED,
wxCommandEventHandler(frmQuery::OnChangeConnection));

     if (mainForm)
         mainForm->RemoveFrame(this);
@@ -632,10 +633,6 @@

 void frmQuery::OnChangeConnection(wxCommandEvent &ev)
 {
-    // On Solaris, this event seems to get fired when the form closes(!!)
-    if(!IsVisible())
-        return;
-
     unsigned int sel=cbConnection->GetCurrentSelection();
     if (sel == cbConnection->GetCount()-1)
     {

pgadmin-hackers by date:

Previous
From: Zdenek Kotala
Date:
Subject: Re: pgadmin3-1.6.1 - core dumped - Work around
Next
From: Dhanaraj M
Date:
Subject: Re: pgadmin3-1.6.1 - core dumped - Work around