lmi
[Top][All Lists]
Advanced

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

Re: [lmi] Not urgent: a plausible micro-optimization


From: Vadim Zeitlin
Subject: Re: [lmi] Not urgent: a plausible micro-optimization
Date: Wed, 21 Feb 2018 23:22:52 +0100

On Wed, 21 Feb 2018 22:14:40 +0000 Greg Chicares <address@hidden> wrote:

GC> On 2018-02-17 16:56, Vadim Zeitlin wrote:
GC> [...]
GC> >   https://github.com/vadz/lmi/pull/68
GC> 
GC> 
GC> I have a question about one detail here:
GC> 
GC> +        wxDocMDIChildFrame const* c = dynamic_cast<wxDocMDIChildFrame*>(w);
GC>          if(c)
GC>              {
GC>              IllustrationView* v = 
dynamic_cast<IllustrationView*>(c->GetView());
GC>              if(v)
GC>                  {
GC>                  v->DisplaySelectedValuesAsHtml();
GC> +
GC> +                // Update the display immediately to display the new data 
as
GC> +                // soon as possible, without waiting for the other views.
GC> +                v->GetFrame()->Update();
GC>                  }
GC>              }
GC> 
GC> On the last added line, would
GC>   c->Update();
GC> do the same thing as
GC>   v->GetFrame()->Update();
GC> because 'c' is certainly the wxDocMDIChildFrame of 'v'?

 Yes, it would.

GC> Is it necessarily the one-and-only frame window of 'v'?

 Yes, there is a 1-to-1 correspondence between wxDocChildFrames and wxViews
in a steady state (I'm being careful here because during initialization and
termination, the link may be not yet established or already broken, but
this can't be the case here).

GC> I've temporarily added this for testing:
GC> +                LMI_ASSERT(v->GetFrame() == c);
GC>                  v->GetFrame()->Update();
GC> and I haven't found a way to make that assertion fail, but
GC> I'd like to be sure I'm not missing some subtlety.

 No, not at all, sorry for creating the impression that the call to
GetFrame() was necessary -- it is not. I wrote it like this just because it
seemed natural to update the view by calling something on the view pointer
itself, but we could just as well call it on "c" directly and I'm perfectly
fine with doing it like this.

 Sorry for the (hopefully now dissipated) confusion,
VZ


reply via email to

[Prev in Thread] Current Thread [Next in Thread]