[haiku-webkit-commits] r225 - webkit/trunk/WebKit/haiku/HaikuLauncher

  • From: webkit@xxxxxxxxxxxxxxx
  • To: haiku-webkit-commits@xxxxxxxxxxxxx
  • Date: Fri, 26 Feb 2010 08:53:11 +0000

Author: stippi
Date: Fri Feb 26 08:53:10 2010
New Revision: 225
URL: http://mmlr.dyndns.org/changeset/225

Log:
Fix crash on program exit. Always good to use defensive programming 
techniques...

Modified:
   webkit/trunk/WebKit/haiku/HaikuLauncher/LauncherWindow.cpp

Modified: webkit/trunk/WebKit/haiku/HaikuLauncher/LauncherWindow.cpp
==============================================================================
--- webkit/trunk/WebKit/haiku/HaikuLauncher/LauncherWindow.cpp  Fri Feb 26 
00:42:59 2010        (r224)
+++ webkit/trunk/WebKit/haiku/HaikuLauncher/LauncherWindow.cpp  Fri Feb 26 
08:53:10 2010        (r225)
@@ -353,13 +353,22 @@
     }
 
     case TAB_CHANGED: {
-        int32 index = message->FindInt32("index");
-        
SetCurrentWebView(dynamic_cast<BWebView*>(m_tabView->ViewForTab(index)));
-        updateTitle(m_tabView->TabAt(index)->Label());
-        m_url->SetText(CurrentWebView()->MainFrameURL());
-        // Trigger update of the interface to the new page, by requesting
-        // to resend all notifications.
-        CurrentWebView()->WebPage()->ResendNotifications();
+       // This message may be received also when the last tab closed, i.e. 
with index == -1.
+        int32 index = -1;
+        message->FindInt32("index", &index);
+        BWebView* webView = 
dynamic_cast<BWebView*>(m_tabView->ViewForTab(index));
+        SetCurrentWebView(webView);
+        BTab* tab = m_tabView->TabAt(index);
+        if (tab)
+            updateTitle(tab->Label());
+        else
+            updateTitle("");
+        if (webView) {
+            m_url->SetText(webView->MainFrameURL());
+            // Trigger update of the interface to the new page, by requesting
+            // to resend all notifications.
+            webView->WebPage()->ResendNotifications();
+        }
         break;
     }
 

Other related posts:

  • » [haiku-webkit-commits] r225 - webkit/trunk/WebKit/haiku/HaikuLauncher - webkit