title: delwin does not delete the window
body: <p>I'm using Rust for my ncurses app.</p>
  
  <p>When the user presses F5, line numbers window should be toggled. When the user presses the F5 key for the first time, the window appears as it is supposed to. However, on second key press, the window does not go away, it's still there, as if the delwin call does not succeed. I tried refreshing the screen after it, but have had no success.</p>
  
  <p>Here's a minimal example:</p>
  
  <pre><code>use ncurses::*;
  
  struct LineNumbers {
      window: WINDOW, 
      shown: bool
  }
  
  impl LineNumbers {
      fn new() -&gt; LineNumbers {
          LineNumbers {
              window: newwin(LINES(), 5, 0, 0),
              shown: false                
          }
      }
  
      fn toggle(&amp;mut self) {
          if self.shown == true {
              self.hide();
          } else {
              self.show();
          }
      }
  
      fn show(&amp;mut self) {
          self.shown = true;
          wbkgd(self.window, COLOR_PAIR(1));
          wrefresh(self.window);
      }
  
      fn hide(&amp;mut self) {
          self.shown = false;
          delwin(self.window);
          refresh();
      }
  }
  
  
  fn main() {
      setlocale(LcCategory::all, "");
      initscr();
      keypad(stdscr(), true);
      start_color();
      init_pair(1, COLOR_RED, COLOR_RED);
      let mut ln = LineNumbers::new();
      loop {
          let user_input = get_wch();
          match user_input.unwrap() {
              WchResult::Char(ch) =&gt; {
                  match ch {
                      27 =&gt; break,
                      _ =&gt; {}
                  }
              },
              WchResult::KeyCode(code) =&gt; {
                  match code {
                      KEY_F5 =&gt; {
                          ln.toggle();
                      },
                      _ =&gt; {}
                  }
              }
          }
      }
      endwin();
  }
  </code></pre>
  
  <p>What could be the issue?</p>