Commit 14ce9baa authored by Dan Winship's avatar Dan Winship

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
parent 524b7043
......@@ -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);
}
}
......
#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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment