title: IPython crashes on tab completion
body: <p>I've encountered an annoying issue causing ipython to crash on tab completion. Occurs frequently and persistently, yet without any clear indication what causes it. Has anyone else encountered this? If so, is there a workaround? I'm running IPython 6.2.1 on Python 3.6.4.</p>
  
  <p>Here's the error message just before the crash, right after a tab button is pressed on a class attribute <code>&gt;In [35]: class_instance.attri&lt;tab&gt;</code>:</p>
  
  <pre><code>Exception ignored in: &lt;bound method Image.__del__ of &lt;tkinter.PhotoImage object at 0x7f5e4832e470&gt;&gt;
  Traceback (most recent call last):
    File "/home/foobar/.pyenv/versions/3.6.4/lib/python3.6/tkinter/__init__.py", line 3501, in __del__
      self.tk.call('image', 'delete', self.name)
  RuntimeError: main thread is not in main loop
  In [15]: class_instance.specfiTcl_AsyncDelete: async handler deleted by the wrong thread
  [1]    23894 abort (core dumped)  ipython
  </code></pre>
  
  <p>Apologies for not being able to reliably reproduce this one - as I said earlier, it seems to occur semi-randomly at tab completion. That being said, importing <code>matplotlib</code> and/or running in <code>--pylab</code> mode might be relevant.</p>