@@ -237,8 +237,6 @@ Plateau2::Plateau2(const InstanceInfo& info)
237237
238238 pGraphics->AttachControl (tank1Select);
239239 pGraphics->AttachControl (tank2Select);
240-
241- initalizedInterface = true ;
242240 };
243241#endif
244242}
@@ -320,20 +318,24 @@ void Plateau2::UpdateSendVisibility() {
320318 SVGs[4 ]->Hide (currentPage != 2 || (!dangerous && tank2Selected));
321319}
322320
321+ bool Plateau2::WindowIsOpen () {
322+ IGraphics* pGraphics = GetUI ();
323+ return pGraphics && pGraphics->WindowIsOpen ();
324+ }
323325
324326void Plateau2::OnParamChange (int index)
325327{
326328 switch (index) {
327329 case kClear :
328- if (initalizedInterface ) {
330+ if (WindowIsOpen () ) {
329331 if (GetParam (kClear )->Value () >= 0.5 ) {
330332 SetParameterValue (kClear1 , GetParam (kClear )->Value ());
331333 SetParameterValue (kClear2 , GetParam (kClear )->Value ());
332334 }
333335 }
334336 break ;
335337 case kFreeze :
336- if (initalizedInterface )
338+ if (WindowIsOpen () )
337339 {
338340 if (GetParam (kFreeze )->Value () >= 0.5 ) {
339341 SetParameterValue (tank2Selected ? kFreeze1 : kFreeze2 , 1 .);
@@ -510,11 +512,11 @@ void Plateau2::OnParamChange(int index)
510512 break ;
511513
512514 case kDanger :
513- if (! GetParam (kDanger )->Value ()) {
515+ if (GetParam (kDanger )->Value ()<= 0.5 ) {
514516 // Reset the plugin when danger is turned off for safety
515517 SetParameterValue (kClear , 1 );
516518 }
517- if (initalizedInterface ) {
519+ if (WindowIsOpen () ) {
518520 UpdateSendVisibility ();
519521 Knobs[13 ]->Bound = GetParam (kDanger )->Value () ? 135 .f : 72 .6923f ;
520522
0 commit comments