Skip to content

Commit

Permalink
Fixed mutex being wiped out by the garbage collection
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkskwsnck committed Oct 7, 2010
1 parent 4b30069 commit 144dccb
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
24 changes: 12 additions & 12 deletions Program.cs
Expand Up @@ -15,19 +15,19 @@ static void Main()
// Single instance only allowed
bool firstInstance = false;
string mutexName = string.Format("{0} {1}", Application.ProductName, Application.ProductVersion);
Mutex mutex = new Mutex(false, mutexName, out firstInstance);

if (firstInstance)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
new WlipperForm();
Application.Run();
}
else
using (Mutex mutex = new Mutex(false, mutexName, out firstInstance))
{
MessageBox.Show(string.Format(Localization.INSTANCE_RUNNING, Application.ProductName, Application.ProductVersion), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
Application.Exit();
if (firstInstance)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
new WlipperForm();
Application.Run();
}
else
{
MessageBox.Show(string.Format(Localization.INSTANCE_RUNNING, Application.ProductName, Application.ProductVersion), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Expand Up @@ -32,5 +32,5 @@
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.5.7.5")]
[assembly: AssemblyFileVersion("3.5.7.5")]
[assembly: AssemblyVersion("3.5.8.5")]
[assembly: AssemblyFileVersion("3.5.8.5")]
8 changes: 7 additions & 1 deletion ReadMe.htm
Expand Up @@ -30,7 +30,7 @@ <h2>
Version
</h2>
<p>
3.5.7.5
3.5.8.5
</p>
<h2>
Description
Expand Down Expand Up @@ -126,6 +126,12 @@ <h2>
</h2>
<!-- Major.Minor.Bugfix.Revision -->
<ul>
<li>
<b>3.5.8.5</b>
<ul>
<li>Fixed single instance behaviour of the application.</li>
</ul>
</li>
<li>
<b>3.5.7.5</b>
<ul>
Expand Down
2 changes: 1 addition & 1 deletion wlipper.xml
Expand Up @@ -2,5 +2,5 @@
<!-- Common information about Wlipper -->
<application>
<name>Wlipper</name>
<version>3.5.7.5</version>
<version>3.5.8.5</version>
</application>

0 comments on commit 144dccb

Please sign in to comment.