public inbox for sourcenav@sourceware.org
 help / color / mirror / Atom feed
From: Ian Roxborough <irox@redhat.com>
To: Mo DeJong <supermo@bayarea.net>
Cc: insight@sources.redhat.com, sourcenav@sources.redhat.com
Subject: Re: Patch to get rid of error when closing last window
Date: Thu, 21 Feb 2002 20:34:00 -0000	[thread overview]
Message-ID: <3C75BFE5.20102E28@redhat.com> (raw)
In-Reply-To: <20020219151830.7598809d.supermo@bayarea.net>

Hi,

I've check this in.  Thanks Mo.

Ian.


Mo DeJong wrote:
> 
> Hi all.
> 
> Here is a patch that fixes a problem in Source-Navigator related to closing
> of the last main window. The bug was caused by a problem in Itk where
> a component in an Itk megawidget would not get destroyed if it was not a
> child of the hull. The attached patch fixes the problem and adds test cases
> to Itk for the areas that were changed.
> 
> This patch has already been submitted to the Itk maintainers at SF. Michael
> McLennan's comment on the patch is as follows:
> 
> This patch looks good. If you want to apply it to CVS, you have my blessing
> and my thanks.
> 
> cheers
> Mo DeJong
> 
> 2002-02-19  Mo DeJong  <supermo@bayarea.net>
> 
>         * itk/library/Toplevel.itk (destructor):
>         * itk/library/Widget.itk (destructor): Remove the
>         hull component after destroying the hull.
>         Destroy any component that still exists after
>         destroying the hull since it must have been
>         created outside the hull.
>         * itk/tests/toplevel.test:
>         * itk/tests/widget.test: Test that a component
>         outside the hull is destroyed when the mega-widget
>         is destroyed.
> 
> Index: itk/library/Toplevel.itk
> ===================================================================
> RCS file: /cvs/src/src/itcl/itk/library/Toplevel.itk,v
> retrieving revision 1.1.1.2
> diff -u -r1.1.1.2 Toplevel.itk
> --- Toplevel.itk        2001/09/09 19:49:05     1.1.1.2
> +++ Toplevel.itk        2002/02/19 23:05:11
> @@ -63,6 +63,12 @@
>              }
>              destroy $itk_hull
>          }
> +        itk_component delete hull
> +
> +        # Any remaining components must be outside the hull
> +        foreach component [component] {
> +            destroy [component $component]
> +        }
>      }
> 
>      itk_option define -title title Title "" {
> Index: itk/library/Widget.itk
> ===================================================================
> RCS file: /cvs/src/src/itcl/itk/library/Widget.itk,v
> retrieving revision 1.1.1.2
> diff -u -r1.1.1.2 Widget.itk
> --- Widget.itk  2001/09/09 19:49:05     1.1.1.2
> +++ Widget.itk  2002/02/19 23:05:11
> @@ -64,6 +64,12 @@
>              }
>              destroy $itk_hull
>          }
> +        itk_component delete hull
> +
> +        # Any remaining components must be outside the hull
> +        foreach component [component] {
> +            destroy [component $component]
> +        }
>      }
> 
>      private variable itk_hull ""
> Index: itk/tests/toplevel.test
> ===================================================================
> RCS file: /cvs/src/src/itcl/itk/tests/toplevel.test,v
> retrieving revision 1.1.1.2
> diff -u -r1.1.1.2 toplevel.test
> --- toplevel.test       2001/09/09 19:49:06     1.1.1.2
> +++ toplevel.test       2002/02/19 23:05:11
> @@ -79,6 +79,45 @@
>      itcl::find objects .testToplevel*
>  } {}
> 
> +test toplevel-1.7 {when an mega-widget object is deleted, its window and any
> +        components are destroyed } {
> +    TestToplevel .delme
> +    set label [.delme component test1]
> +    itcl::delete object .delme
> +    list [winfo exists .delme] [winfo exists $label]
> +} {0 0}
> +
> +test toplevel-1.8 {when a mega-widget object is deleted, its window and any
> +        components are destroyed (even if in another window) } {
> +    itcl::class ButtonTop {
> +        inherit itk::Toplevel
> +
> +        constructor {args} {
> +            eval itk_initialize $args
> +
> +           itk_component add button {
> +                button $itk_option(-container).b -text Button
> +           } {}
> +            pack $itk_component(button)
> +        }
> +
> +        itk_option define -container container Container {}
> +    }
> +
> +    toplevel .t1
> +    ButtonTop .t2 -container .t1
> +
> +    set button [.t2 component button]
> +
> +    itcl::delete object .t2
> +
> +    set result [list $button [winfo exists $button]]
> +
> +    itcl::delete class ButtonTop
> +
> +    set result
> +} {.t1.b 0}
> +
>  # ----------------------------------------------------------------------
>  #  Clean up
>  # ----------------------------------------------------------------------
> Index: itk/tests/widget.test
> ===================================================================
> RCS file: /cvs/src/src/itcl/itk/tests/widget.test,v
> retrieving revision 1.1.1.2
> diff -u -1 -r1.1.1.2 widget.test
> --- widget.test 2001/09/09 19:49:06     1.1.1.2
> +++ widget.test 2002/02/19 23:06:23
> @@ -267,2 +267,38 @@
> 
> +test widget-1.27 {when a mega-widget object is deleted, its window and any
> +        components are destroyed (even if in another window) } {
> +    itcl::class ButtonWidget {
> +        inherit itk::Widget
> +
> +        constructor {args} {
> +            eval itk_initialize $args
> +
> +           itk_component add button {
> +                button $itk_option(-container).b -text Button
> +           } {}
> +            pack $itk_component(button)
> +        }
> +
> +        itk_option define -container container Container {}
> +    }
> +
> +    toplevel .t1
> +    frame .t1.f
> +    ButtonWidget .t1.bw -container .t1.f
> +
> +    pack .t1.f
> +    pack .t1.bw
> +
> +    set button [.t1.bw component button]
> +
> +    itcl::delete object .t1.bw
> +
> +    set result [list $button [winfo exists $button]]
> +
> +    itcl::delete class ButtonWidget
> +
> +    set result
> +} {.t1.f.b 0}
> +
> +
>  # ----------------------------------------------------------------------

      reply	other threads:[~2002-02-22  2:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-12 16:49 Mo DeJong
2002-02-12 17:15 ` Ian Roxborough
2002-02-13  1:51   ` Mo DeJong
2002-02-19 20:27 ` Mo DeJong
2002-02-21 20:34   ` Ian Roxborough [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3C75BFE5.20102E28@redhat.com \
    --to=irox@redhat.com \
    --cc=insight@sources.redhat.com \
    --cc=sourcenav@sources.redhat.com \
    --cc=supermo@bayarea.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).