jvm crash on ubuntu 8.10 with javaxpcom code
Gonzalo Tirapegui <[email protected]> Mon, 09 Mar 2009 00:15:32 -0300
| Newsgroups | gmane.comp.mozilla.devel.java |
|---|---|
| Message-ID | <[email protected]> |
Hi all
i'm trying to run some examples of the javaxpcom interfaces , in order
to do that , i've download the xulrunner-sdk tar and execute the
following code :
public class Main {
public static class LocationProvider implements IAppFileLocProvider {
File grePath;
public LocationProvider(File grePath) {
this.grePath = grePath;
}
public File getFile(String aProp, boolean[] aPersistent) {
System.out.println(aProp);
System.out.println(aPersistent);
File file = null;
if (aProp.equals("GreD") || aProp.equals("GreComsD")) {
file = grePath;
if (aProp.equals("GreComsD")) {
file = new File(file, "components");
}
} else if (aProp.equals("MozBinD") || aProp.equals("CurProcD")
|| aProp.equals("ComsD") || aProp.equals("ProfD")) {
file = grePath;
if (aProp.equals("ComsD")) {
file = new File(file, "components");
}
}
return file;
}
public File[] getFiles(String aProp) {
System.out.println(aProp);
File[] files = null;
if (aProp.equals("APluginsDL")) {
files = new File[1];
files[0] = new File(grePath, "plugins");
}
return files;
}
}
public static void main(String[] args) {
System.setProperty("GRE_HOME",
"/home/teckla/core/xulrunner-sdk/bin");
System.setProperty("java.library.path",
"/home/teckla/core/xulrunner-sdk/bin");
Mozilla mozilla = Mozilla.getInstance();
GREVersionRange[] range = new GREVersionRange[1];
range[0] = new GREVersionRange("1.8.0", true, "1.9", false);
// work with trunk nightly version 1.9a1
try {
File grePath = Mozilla.getGREPathWithProperties(range, null);
System.out.println(grePath.toString());
mozilla.initialize(grePath);
LocationProvider locProvider = new LocationProvider(grePath);
mozilla.initEmbedding(grePath, grePath, locProvider);
// Note, on linux, gtk has to be already initialized for
this code to work
Mozilla moz = Mozilla.getInstance();
// Now we need to start an XUL application, so we get an
instance of the XPCOM service manager
nsIServiceManager serviceManager = moz.getServiceManager();
// Now we need to get the
@mozilla.org/toolkit/app-startup;1 service:
nsIAppStartup appStartup =
(nsIAppStartup)serviceManager.getServiceByContractID("@mozilla.org/toolkit/app-startup;1",
nsIAppStartup.NS_IAPPSTARTUP_IID);
// Get the nsIWindowWatcher interface to the above
nsIWindowCreator windowCreator =
(nsIWindowCreator)appStartup.queryInterface(nsIWindowCreator.NS_IWINDOWCREATOR_IID);
// Get the window watcher service
nsIWindowWatcher windowWatcher =
(nsIWindowWatcher)serviceManager.getServiceByContractID("@mozilla.org/embedcomp/window-watcher;1",
nsIWindowWatcher.NS_IWINDOWWATCHER_IID);
// Set the window creator (from step 6)
windowWatcher.setWindowCreator(windowCreator);
// Create the root XUL window:
nsIDOMWindow win = windowWatcher.openWindow(null,
"chrome://your-app/content/window.xul", "mywindow",
"chrome,resizable,centerscreen", null);
// Set this as the active window
windowWatcher.setActiveWindow(win);
// Hand over the application to xpcom/xul, this will block:
appStartup.run();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (XPCOMException e) {
e.printStackTrace();
}
}
}
.... but by some reason , the jvm crash on the line :
nsIDOMWindow win = windowWatcher.openWindow(null,
"chrome://your-app/content/window.xul", "mywindow",
"chrome,resizable,centerscreen", null);
giving the following trace :
(process:22320): GLib-GObject-CRITICAL **:
/build/buildd/glib2.0-2.18.2/gobject/gtype.c:2458: initialization
assertion failed, use IA__g_type_init() prior to this function
(process:22320): GLib-CRITICAL **: g_once_init_leave: assertion
`initialization_value != 0' failed
(process:22320): Gdk-CRITICAL **: gdk_screen_get_rgb_visual: assertion
`GDK_IS_SCREEN (screen)' failed
#
# An unexpected error has been detected by Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x90209a6c, pid=22320, tid=3084917648
#
# Java VM: Java HotSpot(TM) Server VM (10.0-b23 mixed mode linux-x86)
# Problematic frame:
# C [libxul.so+0x84aa6c]
#
# An error report file with more information is saved as:
# /home/teckla/Escritorio/lobobrowser
tests/testxulrunner/hs_err_pid22320.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Java Result: 134
Can anyone help me with this issue?
Regards , Gonzalo Tirapegui Medina