Repository: spyder-ide/spyder

Issue:
Error on startup with non-clean config file (from previous files/projects open?) and recent master builds
<!--- **PLEASE READ:** When submitting here, please ensure you've completed the following checklist and checked the boxes to confirm. Issue reports without it may be closed. Thanks! --->

### Issue Report Checklist

* [x] Searched the [issues page](https://github.com/spyder-ide/spyder/issues?q=is%3Aissue) for similar reports
* [x] Read the relevant sections of the [Spyder Troubleshooting Guide](https://github.com/spyder-ide/spyder/wiki/Troubleshooting-Guide-and-FAQ) and followed its advice
* [x] Reproduced the issue after updating with ``conda update spyder`` (or ``pip``, if not using Anaconda)
* [x] Tried basic troubleshooting (if a bug/error)
    * [x] Restarted Spyder
    * [x] Reset preferences with ``spyder --reset``
    * [x] Tried the other applicable steps from the Troubleshooting Guide
* [x] Completed the **Problem Description**, **Steps to Reproduce** and **Version** sections below


## Problem Description

In recent dev builds of ``master`` (past few days) I've been getting the following error on launch, that otherwise doesn't seem to have ill effect. However, I can't easily reproduce it in a clean config (``--safe-mode``) so I'm not sure if its a bug or something with my configuration switching back and forth between Spyders. This was with just one horizontally split Editor pane. I started getting it before I ever undocked anything or used "New Window"after I'd launched Spyder with your spyder-ide/spyder#8192 once and then switched back to master and launched another Spyder, and now I get it every time I launch ``master`` or the #8192 branch without ``--safe-mode``.

@jnsebgosselin reported he gets this as well, even without any split.


```python-traceback
  File "C:\Users\C. A. M. Gerlach\Documents\dev\SpyderDev\spyder\spyder\plugins\editor\plugin.py", line 1312, in toogle
    conf_name)
  File "C:\Users\C. A. M. Gerlach\Documents\dev\SpyderDev\spyder\spyder\plugins\editor\plugin.py", line 1329, in _toggle_checkable_action
    if self.editorstacks:
AttributeError: 'Editor' object has no attribute 'editorstacks'
```


## Versions
<!--- You can get this information from Help > About Spyder...
or (if Spyder won't launch) the "conda list" command
from the Anaconda Prompt/Terminal/command line. --->

* Spyder version: ``master``
* Python version: 3.6.6
* Qt version: 5.9,6
* PyQt version: 5.9.2
* Operating System name/version: Windows 8.1 x64



Discussion:

Resolving patch:
diff --git a/spyder/plugins/editor.py b/spyder/plugins/editor.py
--- a/spyder/plugins/editor.py
+++ b/spyder/plugins/editor.py
@@ -418,6 +418,14 @@ def __init__(self, parent, ignore_last_opened_files=False):
         self.dock_toolbar_actions = None
         self.edit_menu_actions = None #XXX: find another way to notify Spyder
         self.stack_menu_actions = None
+
+        self.__first_open_files_setup = True
+        self.editorstacks = []
+        self.last_focus_editorstack = {}
+        self.editorwindows = []
+        self.editorwindows_to_be_created = []
+        self.toolbar_list = None
+        self.menu_list = None
         
         # Initialize plugin
         self.initialize_plugin()
@@ -441,14 +449,6 @@ def __init__(self, parent, ignore_last_opened_files=False):
         self.cursor_pos_index = None
         self.__ignore_cursor_position = True
 
-        self.__first_open_files_setup = True
-        self.editorstacks = []
-        self.last_focus_editorstack = {}
-        self.editorwindows = []
-        self.editorwindows_to_be_created = []
-        self.toolbar_list = None
-        self.menu_list = None
-
         # Don't start IntrospectionManager when running tests because
         # it consumes a lot of memory
         if (running_under_pytest()


Test patch: