Re: DoModal isn't reentrant but failure mode could be improved



It is not clear how you can get this situation to come up. The normal way this is done is

CWhateverDialog dlg;
....
dlg.DoModal();

so to call DoModal twice, it means you have not declared the variable as a local variable
in a function. Since there is no advantage to putting it anywhere else (and a severe
disadvantage from what you relate), this looks to me like a violation of good program
design. You should simply not design a program for which this kind of behavior could be
possible. The "unexpected interactions" should have been designed out of existence.

While it is appears to be true that DoModal exhibits pahtological behavior under these
circumstances, it should simply not be possible to have these circumstances ever arise.
Rethink the design.
joe

On Thu, 15 Dec 2005 14:45:41 +0900, "Norman Diamond" <ndiamond@xxxxxxxxxxxxxxxx> wrote:

>It's pretty obvious why a single instance of a CDialog derived class, during
>execution of a call to its DoModal method, can't respond very reasonably to
>another call of its DoModal method. Once we discover that it's being
>attempted, it's obvious why it won't work.
>
>The problem is, when an application accidentally makes that kind of call due
>to unexpected interactions in processing of various Windows Messages, it's
>not pretty obvious that the application has attempted to perform this buggy
>operation.
>
>But it could be made obvious. I think that DoModal() doesn't have to enter
>an infinite loop consuming 100% of the CPU time and making the application
>non-responding. I think that DoModal() could return an error code to anyone
>who calls it while a previous call hasn't returned yet. MFC isn't
>completely dead yet, right? Can this improvement be made?
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: This is brilliant! Just look how long it is! Ha ha ha ha ha ha
    ... First, Previous, Next, Last and paging buttons ... it is bad ui design to have page elements appearing and disappearing ... > Juan T. Llibre ... > ASP.NET MVP ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: responsiblity about MVC
    ... > Does MVC apply to the application design where the controls mentioned ... in MVP the model *and* view (wich includes ... With MVC, ... input and output are seperated but both the view and controler must be ...
    (comp.object)
  • Re: Using sqldataAdapter wizard has two warnings after running it
    ... Brendan Reynolds (MVP) ... "Spencer H. Prue" wrote in message ... > By PK you mean the first column of the first table, ... > you mean the design of my database, ...
    (microsoft.public.data.ado)
  • Re: CSS For Dummies
    ... MVP Front Page ... replicate this exact design, nor for my site to have the sophistication it ... only guides that give the css for example. ... produce something like that layout - eventually. ...
    (microsoft.public.frontpage.programming)
  • Re: UI framework - design principles
    ... already pointed out that Morphic has some serious shortcomings, but I still think those are implementation details and not necessarily design errors. ... As far as I can judge Dolphin, and I'm not talking about MVP, does not really have a framework for creating custom widgets. ...
    (comp.lang.smalltalk.dolphin)

Loading