mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-24 16:55:28 +00:00
Now uses disposable pattern when launching GameWindows and Forms.
This commit is contained in:
parent
cccb14446a
commit
50733e421d
|
@ -84,7 +84,11 @@ namespace Examples
|
||||||
Type ex = example as Type;
|
Type ex = example as Type;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
(ex.GetConstructor(Type.EmptyTypes).Invoke(null) as IExample).Launch();
|
using (GameWindow gw = (GameWindow)(ex.GetConstructor(Type.EmptyTypes).Invoke(null)))
|
||||||
|
{
|
||||||
|
(gw as IExample).Launch();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception expt)
|
catch (Exception expt)
|
||||||
{
|
{
|
||||||
|
@ -120,10 +124,10 @@ namespace Examples
|
||||||
{
|
{
|
||||||
// In this we do not want a different thread: these examples rely on the Application.Idle
|
// In this we do not want a different thread: these examples rely on the Application.Idle
|
||||||
// event, which would then be raised by both the ExampleLauncher thread *and* the new one!
|
// event, which would then be raised by both the ExampleLauncher thread *and* the new one!
|
||||||
Form f = (Form)example.GetConstructor(Type.EmptyTypes).Invoke(null);
|
using (Form f = (Form)example.GetConstructor(Type.EmptyTypes).Invoke(null))
|
||||||
f.ShowDialog(this);
|
{
|
||||||
f.Dispose();
|
f.ShowDialog(this);
|
||||||
f = null;
|
}
|
||||||
}
|
}
|
||||||
catch (Exception expt)
|
catch (Exception expt)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue