← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~linuxdcpp-team/linuxdcpp/trunk] Rev 340: Fixed a rare crash when switching tabs

 

------------------------------------------------------------
revno: 340
committer: Steven Sheehy <steven.sheehy@xxxxxxxxx>
branch nick: trunk
timestamp: Mon 2009-11-02 00:01:55 -0600
message:
  Fixed a rare crash when switching tabs
modified:
  Changelog.txt
  linux/mainwindow.cc


--
lp:linuxdcpp
https://code.launchpad.net/~linuxdcpp-team/linuxdcpp/trunk

Your team LinuxDC++ Team is subscribed to branch lp:linuxdcpp.
To unsubscribe from this branch go to https://code.launchpad.net/~linuxdcpp-team/linuxdcpp/trunk/+edit-subscription.
=== modified file 'Changelog.txt'
--- Changelog.txt	2009-11-02 03:24:22 +0000
+++ Changelog.txt	2009-11-02 06:01:55 +0000
@@ -36,6 +36,7 @@
 [2009-10-20] Application icons now install into theme search path. Allows for visiblity in other apps (e.g. notification daemon). (Steven)
 [2009-10-21] Added a debian folder, man page and desktop file. (Steven)
 [2009-11-02] lp#442475: Fixed crash when adding a search results from user who has left the hub. (Razzloss)
+[2009-11-02] lp#339700: Fixed a rare crash when switching tabs. (Steven)
 
 *** 1.0.3 2009-02-01 ***
 [2008-08-10] lp#256236: Fixed a crash on startup when using auto-open options.

=== modified file 'linux/mainwindow.cc'
--- linux/mainwindow.cc	2009-10-11 03:17:46 +0000
+++ linux/mainwindow.cc	2009-11-02 06:01:55 +0000
@@ -325,8 +325,9 @@
 void MainWindow::raisePage_gui(GtkWidget *page)
 {
 	int num = gtk_notebook_page_num(GTK_NOTEBOOK(getWidget("book")), page);
+	int currentNum = gtk_notebook_get_current_page(GTK_NOTEBOOK(getWidget("book")));
 
-	if (num != -1)
+	if (num != -1 && num != currentNum)
 		gtk_notebook_set_current_page(GTK_NOTEBOOK(getWidget("book")), num);
 }
 
@@ -860,9 +861,16 @@
 
 	if (entry)
 	{
+		// Disable "activate" signal on the tab menu item since it can cause
+		// onPageSwitched_gui to be called multiple times
+		GtkWidget *item = entry->getTabMenuItem();
+		g_signal_handlers_block_by_func(item, (gpointer)onRaisePage_gui, child);
+
 		entry->setActive_gui();
 		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(entry->getTabMenuItem()), TRUE);
 		mw->setTitle(entry->getLabelText()); // Update window title with selected tab label
+
+		g_signal_handlers_unblock_by_func(item, (gpointer)onRaisePage_gui, (gpointer)child);
 	}
 
 	GList *list = (GList *)g_object_get_data(G_OBJECT(notebook), "page-rotation-list");