Le samedi 21 mars 2009 à 14:25:32, Dave Page a écrit :
> On Fri, Mar 20, 2009 at 9:26 PM, Mike Blackwell <maik...@sbcglobal.net> 
wrote:
> > If the server connection drops while on the server status page, a popup
> > is created every time the page refreshes.
> >
> > To reproduce, connect to a server an monitor it, then stop the server.
>
> Any thoughts on the best way to handle this Guillaume? Perhaps just
> stop the refresh timers as soon as a connection error occurs (and
> display a message on the status bar or somewhere).
>

That's what I did in this patch. If it's OK for you, I'll commit it.


-- 
Guillaume.
 http://www.postgresqlfr.org
 http://dalibo.com
Index: pgadmin/frm/frmStatus.cpp
===================================================================
--- pgadmin/frm/frmStatus.cpp	(révision 7736)
+++ pgadmin/frm/frmStatus.cpp	(copie de travail)
@@ -916,9 +916,17 @@
     
 	if (!connection)
 	{
-	    wxLogError(wxT("no connection for status"));
+	    statusTimer->Stop();
+	    locksTimer->Stop();
+	    xactTimer->Stop();
+	    logTimer->Stop();
+		statusBar->SetStatusText(wxT("no connection for status report"));
 	    return;
     }
+
+	checkConnection();
+	if (!connection)
+	    return;
     
     wxCriticalSectionLocker lock(gs_critsect);
 
@@ -1015,10 +1023,18 @@
 
 	if (!connection)
 	{
-	    wxLogError(wxT("no connection for locks"));
+	    statusTimer->Stop();
+	    locksTimer->Stop();
+	    xactTimer->Stop();
+	    logTimer->Stop();
+		statusBar->SetStatusText(wxT("no connection for locks report"));
 	    return;
     }
 
+	checkConnection();
+	if (!connection)
+	    return;
+    
     wxCriticalSectionLocker lock(gs_critsect);
 
     connection->ExecuteVoid(wxT("SET log_statement='none';"));
@@ -1154,10 +1170,18 @@
 
 	if (!connection)
 	{
-	    wxLogError(wxT("no connection for xact"));
+	    statusTimer->Stop();
+	    locksTimer->Stop();
+	    xactTimer->Stop();
+	    logTimer->Stop();
+		statusBar->SetStatusText(wxT("no connection for transactions report"));
 	    return;
     }
 
+	checkConnection();
+	if (!connection)
+	    return;
+    
     wxCriticalSectionLocker lock(gs_critsect);
 
     connection->ExecuteVoid(wxT("SET log_statement='none';"));
@@ -1230,10 +1254,18 @@
 
 	if (!connection)
 	{
-	    wxLogError(wxT("no connection for logs"));
+	    statusTimer->Stop();
+	    locksTimer->Stop();
+	    xactTimer->Stop();
+	    logTimer->Stop();
+		statusBar->SetStatusText(wxT("no connection for log report"));
 	    return;
     }
     
+	checkConnection();
+	if (!connection)
+	    return;
+    
     wxCriticalSectionLocker lock(gs_critsect);
 
     connection->ExecuteVoid(wxT("SET log_statement='none';"));
@@ -1344,6 +1376,10 @@
 	{
 	    delete connection;
 		connection=0;
+	    statusTimer->Stop();
+	    locksTimer->Stop();
+	    xactTimer->Stop();
+	    logTimer->Stop();
 		statusBar->SetStatusText(_("Connection broken."));
 	}
 }
@@ -1825,7 +1861,7 @@
 #endif
     currentPane = PANE_STATUS;
     cbRate->SetValue(rateToCboString(statusRate));
-	if (connection->BackendMinimumVersion(8, 0))
+	if (connection && connection->BackendMinimumVersion(8, 0))
 	{
 		if(statusList->GetSelectedItemCount() > 0) 
 		{
@@ -1859,7 +1895,7 @@
 #endif
 	currentPane = PANE_LOCKS;
 	cbRate->SetValue(rateToCboString(locksRate));
-	if (connection->BackendMinimumVersion(8, 0))
+	if (connection && connection->BackendMinimumVersion(8, 0))
 	{
 		if(lockList->GetSelectedItemCount() > 0) 
 		{
-- 
Sent via pgadmin-support mailing list (pgadmin-support@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-support

Reply via email to