r19951 - gnucash/trunk/src/business/business-gnome - Bug #637041: Revert r19861 as the patch from bug#635439 causes a crash.

Christian Stimming cstim at code.gnucash.org
Thu Dec 16 16:43:21 EST 2010


Author: cstim
Date: 2010-12-16 16:43:21 -0500 (Thu, 16 Dec 2010)
New Revision: 19951
Trac: http://svn.gnucash.org/trac/changeset/19951

Modified:
   gnucash/trunk/src/business/business-gnome/business-gnome-utils.c
   gnucash/trunk/src/business/business-gnome/dialog-payment.c
Log:
Bug #637041: Revert r19861 as the patch from bug#635439 causes a crash.

The patch can be re-applied after the 2.4.0 release is out, but for now
I prefer to defer it until after the release.

To be precise, this patch reverts all parts of bug#635439: r19861, r19860,
r19854, r19853.

Modified: gnucash/trunk/src/business/business-gnome/business-gnome-utils.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/business-gnome-utils.c	2010-12-16 19:59:24 UTC (rev 19950)
+++ gnucash/trunk/src/business/business-gnome/business-gnome-utils.c	2010-12-16 21:43:21 UTC (rev 19951)
@@ -290,6 +290,7 @@
 void gnc_invoice_set_invoice (GtkWidget *widget, GncInvoice *invoice)
 {
     g_return_if_fail (widget != NULL);
+    g_return_if_fail (invoice != NULL);
 
     gnc_general_search_set_selected (GNC_GENERAL_SEARCH (widget), invoice);
 }
@@ -309,6 +310,7 @@
 
     gncOwnerCopy(owner, &isi->owner);
     isi->have_owner = TRUE;
+    gnc_general_search_set_selected(GNC_GENERAL_SEARCH(widget), NULL);
 
     /* Reset the label */
     gnc_invoice_select_search_set_label(isi);

Modified: gnucash/trunk/src/business/business-gnome/dialog-payment.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-payment.c	2010-12-16 19:59:24 UTC (rev 19950)
+++ gnucash/trunk/src/business/business-gnome/dialog-payment.c	2010-12-16 21:43:21 UTC (rev 19951)
@@ -96,30 +96,17 @@
         gtk_widget_destroy (pw->dialog);
 }
 
-/* Forward declaration */
-static void gnc_payment_set_owner (PaymentWindow *pw, GncOwner *owner);
-
 static void
 gnc_payment_dialog_invoice_changed(PaymentWindow *pw)
 {
     GNCLot *lot;
     gnc_numeric val;
-    GncOwner *owner;
 
     /* Set the payment amount in the dialog */
     if (pw->invoice)
     {
         lot = gncInvoiceGetPostedLot (pw->invoice);
         val = gnc_numeric_abs (gnc_lot_get_balance (lot));
-        /* If a invoice is selected without selecting an owner first, or
-         * if the owner for the selected invoice is different from the
-         * previously selected owner, make sure the right owner is
-         * selected. */
-        owner = gncOwnerGetEndOwner (gncInvoiceGetOwner (pw->invoice));
-        if (pw->owner.owner.undefined == NULL || pw->owner.owner.undefined != owner->owner.undefined)
-        {
-            gnc_payment_set_owner (pw, owner);
-        }
     }
     else
     {
@@ -137,20 +124,18 @@
     KvpValue* value;
     KvpFrame* slots;
 
-    /* The selected invoice has a different owner than the newly
-     * selected owner, reset it */
-    if (pw->invoice != NULL && !gncOwnerEqual(gncOwnerGetEndOwner(gncInvoiceGetOwner(pw->invoice)), &pw->owner))
-    {
-        pw->invoice = NULL;
-        gnc_invoice_set_invoice(pw->invoice_choice, NULL);
-    }
-
-    /* Limit the invoice selection to this owner */
+    /* If the owner changed, the invoice selection is invalid */
+    pw->invoice = NULL;
     gnc_invoice_set_owner(pw->invoice_choice, &pw->owner);
+    /* note that set_owner implies ...set_invoice(...,NULL); */
 
     /* in case we don't get the callback */
     gnc_payment_dialog_invoice_changed(pw);
 
+    /* XXX: We should set the sensitive flag on the invoice_choice
+     * based on whether 'owner' is NULL or not...
+     */
+
     /* Now handle the account tree */
     slots = gncOwnerGetSlots(&pw->owner);
     if (slots)
@@ -465,8 +450,8 @@
 
     /*
      * Find an existing payment window.  If found, bring it to
-     * the front.  If we have an actual owner and/or invoice, then set
-     * it in the window.
+     * the front.  If we have an actual owner, then set it in
+     * the window.
      */
 
     pw = gnc_find_first_gui_component (cm_class, find_handler, NULL);
@@ -474,8 +459,6 @@
     {
         if (owner->owner.undefined)
             gnc_payment_set_owner (pw, owner);
-        if (invoice)
-            gnc_invoice_set_invoice (pw->invoice_choice, invoice);
 
         gtk_window_present (GTK_WINDOW(pw->dialog));
         return(pw);



More information about the gnucash-changes mailing list