[caribou] module: fix module loading/unloading
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [caribou] module: fix module loading/unloading
- Date: Mon, 19 Sep 2011 11:33:19 +0000 (UTC)
commit 14ce9baa44fec03d3d75c9871c45fa60b971c36e
Author: Dan Winship <danw gnome org>
Date: Thu Sep 15 09:39:09 2011 -0400
module: fix module loading/unloading
Force the module to stay resident after being loaded (otherwise it
will crash if it's loaded, unloaded, and loaded again, because it will
fail to register its types the second time).
Also fix a few bugs in the unload() function, even though it is no
longer used at this point. To be fixed for 3.4.
https://bugzilla.gnome.org/show_bug.cgi?id=655979
modules/gtk3/caribou-gtk-module.vala | 8 +++-----
modules/gtk3/caribou-module.c | 18 ++++++++----------
2 files changed, 11 insertions(+), 15 deletions(-)
---
diff --git a/modules/gtk3/caribou-gtk-module.vala b/modules/gtk3/caribou-gtk-module.vala
index a33f1a0..b50522b 100644
--- a/modules/gtk3/caribou-gtk-module.vala
+++ b/modules/gtk3/caribou-gtk-module.vala
@@ -13,7 +13,6 @@ namespace Caribou {
private GLib.HashTable<Gtk.Window, bool> windows;
private Keyboard keyboard;
private Gdk.Display display;
- private Atk.TextRectangle cursor_rect;
public GtkModule () {
windows = new GLib.HashTable<Gtk.Window, bool> (null, null);
@@ -140,10 +139,9 @@ namespace Caribou {
public void unload () {
Gdk.window_remove_filter(null, event_filter);
- windows = new GLib.HashTable<Gtk.Window, bool> (null, null);
- cursor_rect.x = cursor_rect.y = cursor_rect.width = cursor_rect.height = 0;
- keyboard = null;
- display = null;
+
+ foreach (Gtk.Window window in windows.get_keys ())
+ window.notify["has-toplevel-focus"].disconnect (toplevel_focus_changed);
}
}
diff --git a/modules/gtk3/caribou-module.c b/modules/gtk3/caribou-module.c
index 90f0534..7792bd9 100644
--- a/modules/gtk3/caribou-module.c
+++ b/modules/gtk3/caribou-module.c
@@ -1,11 +1,7 @@
#include <gtk/gtk.h>
-#include <gtk/gtkimmodule.h>
#include "caribou-gtk-module.h"
-#include <stdio.h>
-#define CARIBOU_LOCALDIR ""
-
-G_MODULE_EXPORT CaribouGtkModule * gtk_module;
+CaribouGtkModule * gtk_module;
G_MODULE_EXPORT CaribouGtkModule *
gtk_module_init (gint *argc, gchar ***argv[]) {
@@ -17,10 +13,12 @@ gtk_module_init (gint *argc, gchar ***argv[]) {
G_MODULE_EXPORT const gchar*
g_module_check_init (GModule *module)
{
- return gtk_check_version (GTK_MAJOR_VERSION, 0, 0);
-}
+ const gchar *error;
+
+ error = gtk_check_version (GTK_MAJOR_VERSION, 0, 0);
+ if (error)
+ return error;
-G_MODULE_EXPORT void
-g_module_unload(GModule *module) {
- caribou_gtk_module_unload (gtk_module);
+ g_module_make_resident (module);
+ return NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]