failing unregistration lead to crashes in several addons
Open, NormalPublic

Description

System Information
all

Blender Version
Broken: latest master

Short description of error
Those addons don't properly unregister everything, leading to crashes and possibly user pref/keymap corruption:
NPStation (solved)
archipack (solved)
add mesh: castle
measure panel (solved)
dynamic context menu (in interaction with other addons)
layer management (solved)
animated text
kjartan's script (solved)
autotracker (in interaction with other addons)
creaprim

Exact steps for others to reproduce the error
activate and then deactivate one of this addon. If you save userpref after it, your user preferences may be corrupted. Only deleting it works then.

Details

Type
Bug

hi, will look, can we have some more information?
lijenstina has been working on reg issues, although i'm not finding any issue with dynamic context menu.
@john peterson (bliblubli) are you talking about search for unknown operator on unreg?

I'm speaking about addons that don't support to be reloaded. The new template system allows to have different addons activated depending on the startup file chosen. It sometime lead to reloading addons (like F8) and crashes when those don't correctly reload.

Hi @john peterson (bliblubli), can't reproduce the problem, what kind of console error do you get?

Hi @Okavango (Okavango) , can't reproduce either in latest build, I must have had an old build somewhere. Updated task.

I tested the other ones again to see if the new build solve the other problems:
measure panel support F8 now as long is it was not activated, otherwise, creating a new file or reloading give this error:

Traceback (most recent call last):
  File "C:\bl\blender-2.78.0-git.3bf69b2-windows64\2.78\scripts\addons_contrib\space_view3d_panel_measure.py", line 948, in cancel
    display_measurements.handle_remove(context)
NameError: name 'display_measurements' is not defined

@Brendon Murphy (meta-androcto) creaprime, castle and animated text stil have reloading problems, other are solved :)

@john peterson (bliblubli)
I'll look at the problem next week after some remaining fixes for the release add-ons. By bcon4 this will be addressed :)

hi, thanks for heads up & fixes

ok, tested a little bit more. Some errors only show up when other addons are activated. An easy way to see it is to activate all addons and press F8, then you get the errors form castle, creaprime and animated text plus this:

Read prefs: C:\Users\test\AppData\Roaming\Blender Foundation\Blender\2.78\config\userpref.blend
AL lib: (EE) UpdateDeviceParams: Failed to set 48000hz, got 192000hz instead
found bundled python: C:\blender-2.78.0-git.102394a-windows64\2.78\python
archipack: ready
measureit: Imported multifiles
archimesh: Imported multifiles
Rock generator settings file found:
C:\blender-2.78.0-git.102394a-windows64\2.78\scripts\addons_contrib\add_mesh_rocks\add_mesh_rocks.xml
Rock Generator: Numpy found.
Text is not a valid section.
Text is not a valid section.
------------------------------
Exact Offsets loaded
quickprefs: loading default presets
adding default presets
Exception in module unregister(): 'C:\\blender-2.78.0-git.102394a-windows64\\2.78\\scripts\\addons\\space_view3d_spacebar_menu.py'
Traceback (most recent call last):
  File "C:\blender-2.78.0-git.102394a-windows64\2.78\scripts\modules\addon_utils.py", line 398, in disable
    mod.unregister()
  File "C:\blender-2.78.0-git.102394a-windows64\2.78\scripts\addons\space_view3d_spacebar_menu.py", line 3090, in unregister
    bpy.utils.unregister_class(cls)
RuntimeError: unregister_class(...):, missing bl_rna attribute from 'OrderedMeta' instance (may not be registered)
Exception in module unregister(): 'C:\\blender-2.78.0-git.102394a-windows64\\2.78\\scripts\\addons\\space_clip_editor_autotracker.py'
Traceback (most recent call last):
  File "C:\blender-2.78.0-git.102394a-windows64\2.78\scripts\modules\addon_utils.py", line 398, in disable
    mod.unregister()
  File "C:\blender-2.78.0-git.102394a-windows64\2.78\scripts\addons\space_clip_editor_autotracker.py", line 342, in unregister
    bpy.utils.unregister_class(AutotrackerOperator)
RuntimeError: unregister_class(...):, missing bl_rna attribute from 'OrderedMeta' instance (may not be registered)
addon_utils.disable: add_mesh_extra_objects not loaded.
Reloading: <module 'bl_operators' from 'C:\\blender-2.78.0-git.102394a-windows64\\2.78\\scripts\\startup\\bl_operators\\__init__.py'>
Reloading: <module 'bl_ui' from 'C:\\blender-2.78.0-git.102394a-windows64\\2.78\\scripts\\startup\\bl_ui\\__init__.py'>
Reloading: <module 'keyingsets_builtins' from 'C:\\blender-2.78.0-git.102394a-windows64\\2.78\\scripts\\startup\\keyingsets_builtins.py'>
Reloading: <module 'nodeitems_builtins' from 'C:\\blender-2.78.0-git.102394a-windows64\\2.78\\scripts\\startup\\nodeitems_builtins.py'>
archimesh: Reloaded multifiles
------------------------------
measureit: Reloaded multifiles
tinyCAD: detected reload event.
tinyCAD: reloaded modules, all systems operational
archipack: reload ready
Rock Generator: Numpy found.
Exact Offsets loaded
<bpy_struct, KeyMapItem("text.autocomplete")> key exists
<bpy_struct, KeyMapItem("text.line_break")> key exists
gc.collect() -> 9487

So autotracker and dynamic menu also have reload problem under some circumstances.

There are no traceback for erta mesh but this line:

addon_utils.disable: add_mesh_extra_objects not loaded.

Full log is here if you want: http://pasteall.org/407502

Sergey Sharybin (sergey) triaged this task as "Normal" priority.Jun 9 2017, 11:55 AM

Is anyone actually solving these problems?

Note - the warning:

addon_utils.disable: add_mesh_extra_objects not loaded.

comes from here, as the PovRay add-on enables/disables Mesh Extra Objects.
@Maurice Raybaud (mauriceraybaud) could the wm.addon_userpref_show operator be used instead similarly to the CrackIt add-on?

Done. Thanks

Note - the warning:

addon_utils.disable: add_mesh_extra_objects not loaded.

comes from here, as the PovRay add-on enables/disables Mesh Extra Objects.
@Maurice Raybaud (mauriceraybaud) could the wm.addon_userpref_show operator be used instead similarly to the CrackIt add-on?

@john peterson (bliblubli)
If you have time, can you please test if now there are more problems with the register / unregister / reload all add-ons?
Thanks in advance :)