Comment 41 for bug 93546

Revision history for this message
In , Cyp (cyp) wrote :

Randy,

I suspect that the reason why your RFE was made a dup of this one is because
this bug needs to be resolved before your RFE can be tackled. (In that sense, it
should be 'depends on' this bug, not a dup of it).

Malcolm,

the reason why the HINSTANCE of the previous instance of an application is not
passed to other instances is because HINSTANCE is a win16 thing. In Win16
HINSTANCE is the selector of data segment. Under win32 that selector would be
meaningless since each application has its own descriptor table (unlike under
win16 where _all_ win applications share one descriptor table, ie run in _one_
memory space).

When you start a new instance of Mozilla under Windows, it looks for an existing
instance, and if found, sends that instance a message to open a new window - not
unlike what happens when select "File" -> "New Window". After posting the
message the new instance exits.

There is nothing unusual about this - quite a few applications do it including
Word and IE.

If Moz were to continue as a separate process, it would run into the profile
sharing issues that this bug is all about.

> Explorer/Internet Explorer is an interesting case. It has an option in
> its preferences dialog to run multiple processes.

It does not run multiple processes in the traditional sense of a separate
process. It runs its message loop thread in a separate process (the window,
and only the window, is in a separate process). The window classes, as well
as all data that is not window-specific is in shared memory space. This is
somewhat analogous to creating new processes with the rfork(RFMEM) syscall
under BSD or clone(CLONE_VM) under Linux - bad code in one process will kill
that, and only that, process, but that does not mean that all siblings are
immune to corruption of (shared) mem. If Explorer/IE truly ran one entirely
separate instance per window, every instance of an Explorer/IE window would be
using several megs of memory.

Enough off-topicness for today. :)