Description: Fix for the application crashing issue on clicking Remove button twice under "Display Settings". 
 .
 Resolves the following bug - "Click Settings -> Toolbars -> Display Types. Select any Display Type and click Remove button twice. The Application Crashes."
Author: Prathibha B <prathibhab@cdac.in>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- avogadro-1.0.3.orig/avogadro/src/mainwindow.cpp
+++ avogadro-1.0.3/avogadro/src/mainwindow.cpp
@@ -3271,6 +3271,7 @@ namespace Avogadro
     if(engine) {
       d->glWidget->removeEngine(engine);
       d->engineSettingsWindows.remove(engine);
+      d->currentSelectedEngine = NULL;
     }
   }
 
