lmi
[Top][All Lists]
Advanced

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

Re: [lmi] Use wxWidgets support for safely showing message boxes


From: Vadim Zeitlin
Subject: Re: [lmi] Use wxWidgets support for safely showing message boxes
Date: Thu, 23 Feb 2023 15:37:44 +0100

On Thu, 23 Feb 2023 00:58:27 +0000 Greg Chicares <gchicares@sbcglobal.net> 
wrote:

GC> On 2/23/23 00:00, Vadim Zeitlin wrote:
GC> [...]
GC> >  This looks like a chicken and egg problem to me: we need wx to show the
GC> > message box, but this function is only [supposed to be] used when wx is 
not
GC> > available, so it does seem like it can't use it, almost by definition.
GC> > 
GC> >  But please let me know if I do miss something here
GC> 
GC> Yet msw seems to have solved the chicken and egg problem,

 By conflating the chicken and the egg: there is no such thing as a MSW
system without a GUI, so MessageBox() can always be shown. Under Unix this
is not the case, of course, you can have perfectly functional Unix systems
without any GUI at all, and hence without any way to show a message box.

GC> as we can always pop up a messagebox with a NULL parent;
GC> and if the message text and caption are static strings,
GC> IIRC, then the messagebox will be shown correctly even
GC> in the case of complete resource exhaustion. Does GTK
GC> have nothing similar to cover such contingencies?

 It's not about resources, it's about having a GUI at all. Opening X server
(or Wayland) connection can fail and in this case there is really no way to
show any message box. Of course, normally it's not supposed to, but then we
should have initialized wxGTK successfully and then we should be able to
just use wxMessageBox(), i.e. this function shouldn't be called at all.

 IOW the real problem is that the test you're performing is not realistic
because report_catastrophe() just can't be called from a GUI application,
because if the GUI is running the alert function pointers must have been
initialized and use GUI functions -- yet this is exactly what you do.

 I'm sorry but I really don't see how could we possibly improve this.
Please let me know if you do.

 Thanks,
VZ

Attachment: pgpw6GXnrMLSi.pgp
Description: PGP signature


reply via email to

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