mnemosyne.script: crash on finalise

Bug #1723662 reported by Julian Mehne
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
The Mnemosyne Project
Fix Committed
Undecided
Unassigned

Bug Description

The following code throws an error (on your pbienst branch, as well as the mnemosyne-proj branch (which requires the fix from 2087 from your pbienst branch)):

from mnemosyne.script import Mnemosyne
m = Mnemosyne(None)
m.finalise()

An unexpected error has occurred.
Please forward the following info to the developers:

Traceback (innermost last):
  File "./test.py", line 12, in <module>
    m.finalise()
  File "/home/kelvin/tmp/mnemosyne-pbienst/mnemosyne/mnemosyne/libmnemosyne/__init__.py", line 398, in finalise
    self.component_manager.deactivate_all()
  File "/home/kelvin/tmp/mnemosyne-pbienst/mnemosyne/mnemosyne/libmnemosyne/component_manager.py", line 131, in deactivate_all
    component.deactivate()
  File "/home/kelvin/tmp/mnemosyne-pbienst/mnemosyne/mnemosyne/libmnemosyne/component.py", line 80, in deactivate
    for component in self.instantiated_gui_components:
 AttributeError: 'ScriptMainWidget' object has no attribute 'instantiated_gui_components'

The reason seems to be that `instantiated_gui_components` is set in `Component.__init__`, but `ScriptMainWidget` defines its own `__init__` that does not call the parent's `__init__`.

This prevents it from crashing, but I'm not sure if it's the right fix:

=== modified file 'mnemosyne/mnemosyne/script/__init__.py'
--- mnemosyne/mnemosyne/script/__init__.py 2017-10-09 11:42:41 +0000
+++ mnemosyne/mnemosyne/script/__init__.py 2017-10-14 21:42:08 +0000
@@ -16,6 +16,7 @@
 class ScriptMainWidget(MainWidget):

     def __init__(self, component_manager):
+ super().__init__(component_manager)
         self.q_and_a = None

Revision history for this message
Peter Bienstman (peter-bienstman) wrote :

committed in pbienst, thanks!

Changed in mnemosyne-proj:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.