Changeset 1639 for branches/eraser6/6.0


Ignore:
Timestamp:
1/22/2010 5:54:47 AM (5 years ago)
Author:
lowjoel
Message:

Fixed race condition when two instance of Eraser are started simultaneously. The first instance would have created the pipe which listens for commands, then creates the program window. The second instance would find the mutex created and connect to the pipe from the first instance. The first instance broadcasts the OnNextInstance? event, but the main thread is still in the constructor of the MainForm?. The program then has a NullReferenceException?. The new behaviour is to initialise the main window before the pipe listening for new instances are created. This also allows the OnInitInstance? event to abort the startup of the program.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eraser6/6.0/Eraser/Program.cs

    r1429 r1639  
    335335                try 
    336336                { 
    337                     //Create the pipe server which will handle connections to us 
    338                     pipeServer = new Thread(ServerMain); 
    339                     pipeServer.Start(); 
    340  
    341337                    //Initialise and run the program. 
    342338                    bool ShowMainForm = OnInitInstance(this); 
    343339                    if (MainForm == null) 
    344340                        return false; 
     341 
     342                    //Create the pipe server which will handle connections to us 
     343                    pipeServer = new Thread(ServerMain); 
     344                    pipeServer.Start(); 
    345345 
    346346                    //Handle the exit instance event. This will occur when the main form 
Note: See TracChangeset for help on using the changeset viewer.