Ticket #1009 (closed defect: fixed)

Opened 4 years ago

Last modified 2 years ago

Plugin manager does not properly disable plugins

Reported by: zenogantner Owned by: zenogantner
Priority: minor Milestone:
Component: plugins Version: 0.70
Keywords: inconsistency Cc:

Description

How to reproduce:

  1. Ensure that e.g. the XML or the LaTeX plugin are enabled.
  2. Load a XML or .tex file.
  3. Disable the plugin.
  4. Try e.g. Ctrl-Shift-C (toggle comment).

Observed: it still works!

Expected: Should not work, because the plugin has status "disabled"

Change History

comment:1 Changed 3 years ago by bowtie

  • Owner set to zenogantner
  • Status changed from new to assigned

Have you tried

=pod

=head2 C<plugin_disable>

The C<plugin_disable> method is called by Padre for various reasons to request
the plug-in do whatever tasks are necessary to shut itself down. This also
provides an opportunity to save configuration information, save caches to
disk, and so on.

Most often, this will be when Padre itself is shutting down. Other uses may
be when the user wishes to disable the plug-in, when the plug-in is being
reloaded, or if the plug-in is about to be upgraded.

If you have any private classes other than the standard C<Padre::Plugin::Foo>, you
should unload them as well as the plug-in may be in the process of upgrading
and will want those classes freed up for use by the new version.

The recommended way of unloading your extra classes is using
L<Class::Unload>. Suppose you have C<My::Extra::Class> and want to unload it,
simply do this in C<plugin_disable>:

  require Class::Unload;
  Class::Unload->unload('My::Extra::Class');

Class::Unload takes care of all the tedious bits for you. Note that you
should B<not> unload any external C<CPAN> dependencies, as these may be needed
by other plug-ins or Padre itself. Only classes that are part of your plug-in
should be unloaded.

Returns true on success, or false if the unloading process failed and your
plug-in has been left in an unknown state.

=cut

from Padre::Plugin

comment:2 Changed 3 years ago by zenogantner

Thank you for the hint.

Just Class::Unload does not do the job, I guess I have also have to replace all objects of that class that currently exist by normal Padre::Document objects.

Will work on that ...

comment:3 Changed 2 years ago by bowtie

  • Status changed from assigned to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.