lmi
[Top][All Lists]
Advanced

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

Re: [lmi] PATCH: fix "--help" for the GUI test


From: Vadim Zeitlin
Subject: Re: [lmi] PATCH: fix "--help" for the GUI test
Date: Fri, 5 Dec 2014 23:56:56 +0100

On Thu, 04 Dec 2014 02:55:34 +0000 Greg Chicares <address@hidden> wrote:

GC> >  As an aside, isn't it surprising to see "untimely warning" in the message
GC> > box displaying usage text? It's anything but untimely, as it's given in
GC> > direct response to the users request, and it's not really a warning
GC> > neither...
GC> 
GC> You are quite right. Apparently it arises because of this in 'skeleton.cpp':
GC> 
GC>     if(show_help)
GC>         {
GC>         getopt_long.usage(warning());
GC>         warning() << std::flush;
GC>         return false;
GC>         }
GC> 
GC> Normally, that would just be a "Warning", which is still incorrect; it's
GC> "Untimely", hence doubly incorrect, because it occurs while this condition
GC> is not met (in 'alert_wx.cpp'):
GC>     if(wxTheApp && wxTheApp->GetTopWindow())
GC> 
GC> I suppose the right way to fix it would be to call wxMessageBox() directly,
GC> with a more appropriate title. But would that be safe, given that there is
GC> no top window and perhaps the message loop isn't running?

 In theory, wxMessageBox() is always safe to use as long as the program
(and wxWidgets) state is not corrupted. We provide a separate
wxSafeShowMessage() just because it has a better chance of working when
nothing can be relied on any longer, e.g. when we're running out of memory,
but here this is clearly not the case.

 Of course, in theory there is no difference between theory and practice.
But in practice, testing the attached patch crashes in the unit test because
there are actually several problems with using wxMessageBox before wxTheApp
is available :-( I fixed all of them in wxWidgets and the git tree

        29cd13cc8f06eab726d3b774e057b64c94570923

contains all of these fixes as well as a few others affecting LMI and is
known to build and work with MinGW 3.4.5. Please update to it before
applying the patch below.


GC> Well, you know this stuff far better than I do; I'd welcome a patch.

 Here is the trivial one doing it for both the main executable and the
test. However it doesn't address the problem of the warning [correctly]
given when encountering an unrecognized command line option still being
"untimely". I think the above mentioned condition in alert_wx.cpp should be
simply removed to fix this. Just in case you agree, I also attach a[n even
more trivial] patch doing this as well.

 Please let me know if you have any questions about either of these
patches,
VZ

Attachment: 0001-Show-command-line-help-in-a-plain-message-box.patch
Description: Text document

Attachment: 0002-Don-t-use-untimely-warnings-and-errors.patch
Description: Text document


reply via email to

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