lmi
[Top][All Lists]
Advanced

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

Re: [lmi] fatal_error_alert() without wxTheApp (was: PATCH: fix "--help"


From: Vadim Zeitlin
Subject: Re: [lmi] fatal_error_alert() without wxTheApp (was: PATCH: fix "--help" for the GUI test)
Date: Sat, 6 Dec 2014 21:25:35 +0100

On Sat, 06 Dec 2014 20:06:05 +0000 Greg Chicares <address@hidden> wrote:

GC> This command
GC>   grep Untimely *.?pp
GC> still finds one match; do you think that occurrence should be changed
GC> e.g. as follows?
GC> 
GC>  void fatal_error_alert(std::string const& s)
GC>  {
GC> -    if(!wxTheApp)
GC> -        {
GC> -        safely_show_message("Untimely error message:\n" + s);
GC> -        }
GC>      throw std::runtime_error(s);
GC>  }
GC> 
GC> I haven't thought it through carefully, so I'm not sure it's trivial.

 I think it is: while fatal_error is used from too many places to review
each of them, we can still confidently say that either it is called when
wxTheApp is null or when it isn't. In the latter case, the exception is
already thrown and will continue to be thrown, so there is no change in
behaviour. But in the former case, throwing from inside fatal_error_alert()
will result in the same safely_show_message() being called due to the
try/catch block in main_wx.cpp and the behaviour will still be the same
as now except that "Untimely error message" prefix would disappear.

 So I'd say this is pretty safe -- and if it turns out that my simplistic
reasoning missed something, I'd still rather fix any problems due wxTheApp
being null we might discover than preventively decide that its non
existence must be a problem.

VZ

reply via email to

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