Re: [evolution-patches] Evolution fix for #307794



hi,

Attached patch fixes the problem. The rebuild is called in the idle
handler and then we have to make sure  that the current page is
displayed after ec_rebuild is over.

Thanks,
Vivek Jain

On Fri, 2005-07-08 at 00:02 +0800, Not Zed wrote:
> Hmm, no c++ comments, its right in theHACKING file.  Go re-read it
> again.
> 
> Anyway, no, you definitly can't do this, they have to be destroyed or it
> will just break the whole e-config model.
> 
> Can you just add an idle handler so the server-changed event doesn't
> directly trigger the rebuild?  Maybe you can just do it in the
> target_changed code in e-config, so it doesn't have to be done in all
> the cases a rebuild is called for.  It might cause other issues though,
> and make sure the idle handler is removed if the object gets finalised
> before it can run, etc.
> 
> So why does this only happen with some versions of gtk+?  Still sounds
> like a gtk+/glib bug to me ...
> 
> (i.e. you can trigger a destroy of any other object from a signal from
> that object).
> 
> 
> On Thu, 2005-07-07 at 20:22 +0530, Arunprakash wrote:
> > Hi all,
> > 
> > I have a crude fix for bug #307794.
> > I have attached the patch.
> > 
> > When you select any item from the "Server Type"
> > combo box, it emits the "changed" signal.
> > 
> > This invokes "emae_provider_changed" callback which in
> > its execution path calls ec_rebuild.
> > 
> > Here the page containing the combox box
> > is destroyed and a new page with items
> > specific for that selected server type
> > is loaded.
> > 
> > But the code in gtkcombobox.c requires
> > that combo box for its pending opertions
> > and is destroyed in the callback.
> > 
> > The same happens for the combo box in the sending page also.
> > Because the same callback is used.
> > 
> > My fix removes that widget destruction leaving a memory leak.
> > 
> > The combo box has to be hold and destroyed later. But how?
> > 
> > Please review it,
> > and give suggestions and comments.
> > 
> > Thanks,
> > Arunprakash.
> > 
> > _______________________________________________
> > evolution-patches mailing list
> > evolution-patches lists ximian com
> > http://lists.ximian.com/mailman/listinfo/evolution-patches
> 
> _______________________________________________
> evolution-patches mailing list
> evolution-patches lists ximian com
> http://lists.ximian.com/mailman/listinfo/evolution-patches
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/e-util/ChangeLog,v
retrieving revision 1.544
diff -u -p -r1.544 ChangeLog
--- ChangeLog	18 Jun 2005 15:59:56 -0000	1.544
+++ ChangeLog	11 Jul 2005 13:42:51 -0000
@@ -1,3 +1,10 @@
+2005-07-11 Vivek Jain <jvivek novell com>
+	
+	* e-config.c: (e_config_target_changed):
+	added a idle handler that calls ec_rebuild after callback operations
+	are completed.
+	**Fixes #307794
+	
 2005-06-18  Tor Lillqvist  <tml novell com>
 
 	* Makefile.am (WIN32_BOOTSTRAP_LIBS): Use bootstrap library for
Index: e-config.c
===================================================================
RCS file: /cvs/gnome/evolution/e-util/e-config.c,v
retrieving revision 1.20
diff -u -p -r1.20 e-config.c
--- e-config.c	28 Apr 2005 09:27:01 -0000	1.20
+++ e-config.c	11 Jul 2005 13:42:52 -0000
@@ -924,6 +924,29 @@ e_config_create_window(EConfig *emp, str
 	return w;
 }
 
+static gboolean
+ec_idle_handler_for_rebuild (gpointer data)
+{
+	EConfig *emp = (EConfig*) data;
+
+	ec_rebuild (emp);
+	if (emp->type == E_CONFIG_DRUID) {
+		if (emp->priv->druid_page) {
+			gnome_druid_set_page((GnomeDruid *)emp->widget, (GnomeDruidPage *)emp->priv->druid_page->frame);
+			ec_druid_check_current(emp);
+		}
+	} else {
+		if (emp->window) {
+			if (e_config_page_check(emp, NULL)) {
+				gtk_dialog_set_response_sensitive((GtkDialog *)emp->window, GTK_RESPONSE_OK, TRUE);
+			} else {
+				gtk_dialog_set_response_sensitive((GtkDialog *)emp->window, GTK_RESPONSE_OK, FALSE);
+			}
+		}
+	}
+	return FALSE;
+}
+
 /**
  * e_config_target_changed:
  * @emp: 
@@ -939,8 +962,10 @@ e_config_create_window(EConfig *emp, str
  **/
 void e_config_target_changed(EConfig *emp, e_config_target_change_t how)
 {
-	if (how == E_CONFIG_TARGET_CHANGED_REBUILD)
-		ec_rebuild(emp);
+	if (how == E_CONFIG_TARGET_CHANGED_REBUILD) {
+		g_idle_add (ec_idle_handler_for_rebuild, emp);
+		return;
+	}
 
 	if (emp->type == E_CONFIG_DRUID) {
 		if (emp->priv->druid_page) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]