title: wxwidget application crashes on exit, when I add code to do drag and drop
body: <p>I have a wxwidget application that uses dragandrop and when I close the application, it crashes on this line:</p>
  
  <pre><code>virtual ~wxDropTargetBase()
      { delete m_dataObject; }
  </code></pre>
  
  <p>I setup the drapand drop in this way:</p>
  
  <pre><code>MainWindow::MainWindow() : MainWindowTemplate(NULL), m_fileDropTarget(textSourceFolder)
  {
      // connect events
      this-&gt;Connect(wxEVT_IDLE, wxIdleEventHandler(MainWindow::OnIdle));
      // set window minimum size - work around bug that ignores outer border and sets min size slightly too small
      wxSize minSize = sizerOuter-&gt;GetMinSize();
      minSize.SetWidth(minSize.GetWidth() + 16);
      minSize.SetHeight(minSize.GetHeight() + 16);
      SetMinSize(minSize);
      Layout();
      // set file drop target
      SetDropTarget(&amp;m_fileDropTarget);
  }
  </code></pre>
  
  <p>and the source code for my </p>
  
  <pre><code>class MyFileDropTarget : public wxFileDropTarget
  {
  public:
      MyFileDropTarget(wxTextCtrl *textCtrl)
      {
          m_fileTextCtrl = textCtrl;
      }
      virtual bool wxFileDropTarget::OnDropFiles (wxCoord x, wxCoord y, const wxArrayString &amp;filenames)
      {
          if (filenames.size() &gt; 0)
          {
              m_fileTextCtrl-&gt;SetValue(filenames.Item(0));
              return true;
          }
          return false;
      }
  private:
      wxTextCtrl *m_fileTextCtrl;
  };
  </code></pre>
  
  <p>what is the problem and how I can fix it?</p>