IMO, there is a general problem with reentrancy that needs general
solution. I've just stumbled into one problem in this class (I've got
autosave in middle of composer construction) and I hotfixed it by
carefully locking that part of code. However I believe it is possible to
solve all problems of this type at once with few small (but hard)
changes.

Let's first look where the problem comes from. When writing code, one
tends to think that every event is executed as atomic transaction, so
one can break invariants as far as they are recovered later in the
event. Modal dialogs change this. Modal dialog executes its own event
processing in middle of another event, so events executed from modal
dialog can find themselves in inconsistent state. With number of dialogs
in Mahogany and thousands of asserts, every function call is dangerous.
We cannot ever lock everything properly.

Now the solution. The idea is to stop event processing in modal dialogs.
You sure imagine many reasons why this cannot be done. IMO, events that
must be let through fall into two classes: (1) internal toolkit and
wxWindows events like repainting that don't call our code and they are
consequently of no interest to us and (2) events related to dialog
itself that modify only data specific to that dialog without locking.

Again, the question is how to fit this into Mahogany. I think this must
be done in wxWindows for number of reasons:
1) Events are fragmented by window, so doing something with dialogs
alone isn't enough.
2) It is also necessary to requeue all blocked events when dialog is
closed, so events have to be stored in some temporary queue and they
must be copiable.
3) Vetoable events must be resumed specially if they are integrated with
platform toolkit.
Yet I think that maintaining temporary queue and then requeuing can be
done in reasonable time with high quality. I know this is another thing
I am not going to do in foreseeable future, but I would like to hear
your opinions/votes about this.



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Mahogany-Developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-developers

Reply via email to