Re: [anjuta-devel] Deactivate plugin handlers not getting called when Anjuta exits?



Hi James,

On Sun, Jun 19, 2011 at 7:15 AM, James Liggett <jrliggett cox net> wrote:
What's happening here is that the plugin gets the unmap signal and then
tries to call to AnjutaApp after its widgets table is destroyed. I think
AnjutaApp is disposed at this point, but not finalized.

What's really happening is that the anjuta window is being destroyed
by gtk+, and anyone potentially holding "pointers" to the widgets
outside have not been informed before.

In your specific case, when anjuta shuts down by user closing the
window, the plugins are not deactivated, but the gtk window is being
destroyed (hence the dock items pointers you are holding in plugins
are not necessarily valid).

I could try
getting a weak reference on AnjutaShell, but I'm not sure that this
would work because those only call the callback when the object is
finalized, not when it's disposed.

You should try to take weak reference on the dock widget on which you
are trying to operate, not AnjutaShell. The shell itself is alive.
Say, you are listening to widget A's map event, and showing widget B
in the shell in the event callback -- keep a weak reference to widget
B.

not to call anjuta_shell_hide_dockable_widget? Does
AnjutaShell/AnjutaApp emit a "destroyed" signal or similar on dispose
like GtkWidget does?

AnjutaShell has "exiting" signal that you can listen to. That should
also work, but it is essentially a same thing as holding weak
reference to the widget B -- it's just being more broader.

However, to potentially fix it better way, try this little change. Put
an else statement at anjuta.c:121 just before the return statement and
call gtk_main_quit() there. The idea is not to bother going any
further with widgets destruction if proper-shutdown wasn't mentioned.
This is also what we wanted originally anyways. If this works, then
it's better than the weak-ref/signal approach.

As an aside, this discussion seems like we're trying to work around a
design flaw in the plugin system, in that they don't properly deactivate
themselves on shutdown. I'd feel much better if we could work that out
somehow...

Fundamentally, it's not a hack, since you don't own the widgets you're
holding, so there is no technical guarantee when they are dead --
unless you take steps to monitor them or avoid being in the middle of
the ambiguity. Plugin deactivations still don't solve it because the
issue remains for widgets used across plugins. Hopefully, the above
gtk_main_quit() changes fixes it, if not, the "exiting" signal, if
not, the weak ref :).

Thanks.

Regards,
-Naba



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]