[patch] attribute editor/wrapper mem cleanup and signal fixes
Douglas Burke <[email protected]>
| Newsgroups | gmane.editors.conglomerate.devel |
|---|---|
| Message-ID | <Pine.GSO.4.58.0410171157540.18492@lagado> |
The attached patch fixes some memory leaks and stops assertion failures from g_signal_handler_block/unblock when CDATA or NMTOKEN editors are created. I looked into bug#122017 - Attribute editor widgets and bindings don't clean up properly - see http://bugzilla.gnome.org/show_bug.cgi?id=122017 The only CongDocument pointers are stored by the CongAttributeEditor and CongAttributeWrapper objects and these both call g_object_ref/g_object_unref, so I'm not convinced this bug is still valid. Or are there other issues that need resolving? Doug
patch.diff
(text/plain, 7.9 KB)
? patch.diff Index: ChangeLog =================================================================== RCS file: /cvs/gnome/conglomerate/src/ChangeLog,v retrieving revision 1.736 diff -u -r1.736 ChangeLog --- ChangeLog 15 Oct 2004 16:01:40 -0000 1.736 +++ ChangeLog 17 Oct 2004 14:43:46 -0000 @@ -1,3 +1,13 @@ +2004-10-17 Nickolay V. Shmyrev <[email protected]> + + * cong-editor-area-composer.c, cong-editor-area-flow-holder.c, cong-editor-area-border.c: + + Fix issues with allocation of children. + + * cong-editor-area.c: + + Fix hidden area requisition handle. + 2004-10-15 Douglas Burke <[email protected]> * cong-attribute-editor-cdata.c, cong-attribute-editor-cdata.h, cong-attribute-editor-enumeration.c, cong-attribute-editor-lang.c, cong-attribute-editor-lang.h, cong-attribute-editor-nmtoken.c, cong-attribute-editor-nmtoken.h, cong-attribute-editor.c, cong-attribute-editor.h, cong-attribute-wrapper-check-button.c, cong-attribute-wrapper-check-button.h, cong-attribute-wrapper-radio-button.c, cong-attribute-wrapper-radio-button.h, cong-attribute-wrapper.c, cong-attribute-wrapper.h, cong-glade.c: Index: cong-editor-area-border.c =================================================================== RCS file: /cvs/gnome/conglomerate/src/cong-editor-area-border.c,v retrieving revision 1.7 diff -u -r1.7 cong-editor-area-border.c --- cong-editor-area-border.c 25 Jun 2004 00:33:02 -0000 1.7 +++ cong-editor-area-border.c 17 Oct 2004 14:43:46 -0000 @@ -145,7 +145,7 @@ if (child) { child_req = cong_editor_area_get_requisition (child, orientation, - width_hint); + width_hint - PRIVATE(border)->left_pixels - PRIVATE(border)->right_pixels); } else { child_req = 0; } Index: cong-editor-area-composer.c =================================================================== RCS file: /cvs/gnome/conglomerate/src/cong-editor-area-composer.c,v retrieving revision 1.14 diff -u -r1.14 cong-editor-area-composer.c --- cong-editor-area-composer.c 25 Jun 2004 00:33:02 -0000 1.14 +++ cong-editor-area-composer.c 17 Oct 2004 14:43:46 -0000 @@ -434,17 +434,14 @@ gint x; gint y; const GdkRectangle *rect = cong_editor_area_get_window_coords(area); -#if 0 - guint this_width = rect->width; - guint this_height = rect->height; -#else + guint this_width = cong_editor_area_get_requisition (area, GTK_ORIENTATION_HORIZONTAL, rect->width); guint this_height = cong_editor_area_get_requisition (area, GTK_ORIENTATION_VERTICAL, rect->width); -#endif + gint total_surplus_space = 0; gint surplus_space_per_expandable_child = 0; guint num_expandable_children = 0; @@ -548,6 +545,7 @@ if (PRIVATE(area_composer)->orientation == GTK_ORIENTATION_HORIZONTAL) { x += child_req_width + PRIVATE(area_composer)->spacing + extra_offset; + this_width -= child_req_width + PRIVATE(area_composer)->spacing + extra_offset; } else { y += child_req_height + PRIVATE(area_composer)->spacing + extra_offset; } Index: cong-editor-area-flow-holder-inlines.c =================================================================== RCS file: /cvs/gnome/conglomerate/src/cong-editor-area-flow-holder-inlines.c,v retrieving revision 1.16 diff -u -r1.16 cong-editor-area-flow-holder-inlines.c --- cong-editor-area-flow-holder-inlines.c 24 Aug 2004 01:58:27 -0000 1.16 +++ cong-editor-area-flow-holder-inlines.c 17 Oct 2004 14:43:46 -0000 @@ -352,18 +352,6 @@ { CongEditorAreaFlowHolderInlines *area_flow_holder_inlines = CONG_EDITOR_AREA_FLOW_HOLDER_INLINES(area); -#if 1 - if (GTK_ORIENTATION_HORIZONTAL==orientation) { - return width_hint; - } else { - g_assert(PRIVATE(area_flow_holder_inlines)->line_composer); - - /* FIXME: do we have a sane way of calculating the height of the inlines yet? */ - return cong_editor_area_get_requisition (CONG_EDITOR_AREA(PRIVATE(area_flow_holder_inlines)->line_composer), - orientation, - width_hint); - } -#else if (PRIVATE(area_flow_holder_inlines)->line_composer) { return cong_editor_area_get_requisition (CONG_EDITOR_AREA(PRIVATE(area_flow_holder_inlines)->line_composer), @@ -372,7 +360,6 @@ } else { return 0; } -#endif } static void Index: cong-editor-area-structural-tag.c =================================================================== RCS file: /cvs/gnome/conglomerate/src/cong-editor-area-structural-tag.c,v retrieving revision 1.14 diff -u -r1.14 cong-editor-area-structural-tag.c --- cong-editor-area-structural-tag.c 24 Aug 2004 02:59:06 -0000 1.14 +++ cong-editor-area-structural-tag.c 17 Oct 2004 14:43:46 -0000 @@ -280,22 +280,22 @@ GtkOrientation orientation, int width_hint) { - if (orientation==GTK_ORIENTATION_HORIZONTAL) { - return width_hint; - } else { - gint title_req; - gint inner_req; - - CongEditorAreaStructuralTag *structural_tag = CONG_EDITOR_AREA_STRUCTURAL_TAG(area); - - title_req = cong_editor_area_get_requisition (PRIVATE(structural_tag)->title_vcompose, - orientation, - width_hint-1); + CongEditorAreaStructuralTag *structural_tag = CONG_EDITOR_AREA_STRUCTURAL_TAG(area); + gint title_req; + gint inner_req; + + title_req = cong_editor_area_get_requisition (PRIVATE(structural_tag)->title_vcompose, + orientation, + width_hint-1); - inner_req = cong_editor_area_get_requisition (PRIVATE(structural_tag)->inner_bin, - orientation, - width_hint-1); + inner_req = cong_editor_area_get_requisition (PRIVATE(structural_tag)->inner_bin, + orientation, + width_hint-1); + + if (orientation==GTK_ORIENTATION_HORIZONTAL) { + return MAX(title_req, inner_req); + } else { return title_req + inner_req + 2; } } Index: cong-editor-area-structural.c =================================================================== RCS file: /cvs/gnome/conglomerate/src/cong-editor-area-structural.c,v retrieving revision 1.10 diff -u -r1.10 cong-editor-area-structural.c --- cong-editor-area-structural.c 24 Aug 2004 02:59:06 -0000 1.10 +++ cong-editor-area-structural.c 17 Oct 2004 14:43:46 -0000 @@ -395,21 +395,22 @@ GtkOrientation orientation, int width_hint) { + CongEditorAreaStructural *structural = CONG_EDITOR_AREA_STRUCTURAL(area); + gint title_req; + gint inner_req; + + title_req = cong_editor_area_get_requisition (PRIVATE(structural)->title_vcompose, + orientation, + width_hint-1); + + + inner_req = cong_editor_area_get_requisition (PRIVATE(structural)->inner_bin, + orientation, + width_hint-1); + if (orientation==GTK_ORIENTATION_HORIZONTAL) { - return width_hint; + return MAX(title_req, inner_req); } else { - gint title_req; - gint inner_req; - - CongEditorAreaStructural *structural = CONG_EDITOR_AREA_STRUCTURAL(area); - - title_req = cong_editor_area_get_requisition (PRIVATE(structural)->title_vcompose, - orientation, - width_hint-1); - - inner_req = cong_editor_area_get_requisition (PRIVATE(structural)->inner_bin, - orientation, - width_hint-1); return title_req + inner_req + 2; } } Index: cong-editor-area.c =================================================================== RCS file: /cvs/gnome/conglomerate/src/cong-editor-area.c,v retrieving revision 1.26 diff -u -r1.26 cong-editor-area.c --- cong-editor-area.c 24 Aug 2004 02:46:40 -0000 1.26 +++ cong-editor-area.c 17 Oct 2004 14:43:46 -0000 @@ -421,6 +421,10 @@ g_return_val_if_fail (IS_CONG_EDITOR_AREA(area), 0); cache = &PRIVATE(area)->requisition_cache[orientation]; + + if (PRIVATE(area)->is_hidden) { + return 0; + } /* If not up-to-date, call fn to regenerate cache: */ if ( (width_hint!=cache->cached_width_hint)