https://bugs.freedesktop.org/show_bug.cgi?id=43415
Bug #: 43415
Summary: SWT window crashes LOo
Classification: Unclassified
Product: LibreOffice
Version: unspecified
Platform: x86 (IA32)
OS/Version: Linux (All)
Status: UNCONFIRMED
Severity: blocker
Priority: medium
Component: Libreoffice
AssignedTo: [email protected]
ReportedBy: [email protected]
Created attachment 54003
--> https://bugs.freedesktop.org/attachment.cgi?id=54003
SWTBrowserAddon.oxt
In my linux box, I created an extension that uses SWT browser to launch an swt
browser window.
when i close this window the whole Openoffice application freezes and becomes
unresponsive for some cases the whole libreoffice crashes after closing the SWt
window.
i suspect this to be related to some issue with GTK. if i remove a SWT call
"display.dispose()' LOo dose'nt crash but my SWT window becomes unusable . if i
try re-launch the SWT window again it doesn’t shows up. removing the
display.dispose() solves the crash but makes my SWT window nu-usable. It seems
the bug is related to this 'display.dispose()' SWT statement which causes the
Loo to crash for some reason .
I'm providing the SWT code below. i also include a oxt demo to replicate this
issue on Linux.
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTError;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.browser.CloseWindowListener;
import org.eclipse.swt.browser.LocationEvent;
import org.eclipse.swt.browser.LocationListener;
import org.eclipse.swt.browser.OpenWindowListener;
import org.eclipse.swt.browser.VisibilityWindowListener;
import org.eclipse.swt.browser.WindowEvent;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
/**
*
* @author othman
*/
public class SWTBrowser {
private Shell shell;
// private Browser browser;
private static final int WINDOW_WIDTH = 780;
private static final int WINDOW_HEIGHT = 570;
/**
* SWTBrowser application entry point
*
* @param args the command line arguments
*/
public static void main(String[] args) {
new SWTBrowser(args.length == 0 ? null : args[0]);
}
/**
* Constructor
*
* @param location the initial location to display
*/
public SWTBrowser(String location) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Main Window");
shell.setLayout(new FillLayout());
final Browser browser;
try {
browser = new Browser(shell, SWT.NONE);
} catch (SWTError e) {
System.out.println("Could not instantiate Browser: "
+ e.getMessage());
display.dispose();
return;
}
initialize(display, browser);
shell.open();
browser.setUrl(location);
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
/* register WindowEvent listeners */
static void initialize(final Display display, Browser browser) {
browser.addOpenWindowListener(new OpenWindowListener() {
@Override
public void open(WindowEvent event) {
if (!event.required) {
return; /* only do it if necessary */
}
Shell shell = new Shell(display);
shell.setText("New Window");
shell.setLayout(new FillLayout());
Browser browser = new Browser(shell, SWT.NONE);
initialize(display, browser);
event.browser = browser;
}
});
browser.addVisibilityWindowListener(new VisibilityWindowListener() {
@Override
public void hide(WindowEvent event) {
Browser browser = (Browser) event.widget;
Shell shell = browser.getShell();
shell.setVisible(false);
}
@Override
public void show(WindowEvent event) {
Browser browser = (Browser) event.widget;
final Shell shell = browser.getShell();
if (event.location != null) {
shell.setLocation(event.location);
}
if (event.size != null) {
org.eclipse.swt.graphics.Point size = event.size;
shell.setSize(shell.computeSize(size.x, size.y));
}
shell.open();
}
});
browser.addCloseWindowListener(new CloseWindowListener() {
@Override
public void close(WindowEvent event) {
Browser browser = (Browser) event.widget;
Shell shell = browser.getShell();
shell.close();
}
});
}
/**
* This class implements a CloseWindowListener for SWTBrowser
*/
class BrowserCloseWindowListener implements CloseWindowListener {
/**
* Called when the parent window should be closed
*/
@Override
public void close(WindowEvent event) {
// Close the parent window
((Browser) event.widget).getShell().close();
}
}
/**
* This class implements a LocationListener for SWTBrowser
*/
class BrowserLocationListener implements LocationListener {
// The address text box to update
//private Text location;
/**
* Constructs an BrowserLocationListener
*
* @param text the address text box to update
*/
public BrowserLocationListener() {
// Store the address box for updates
}
/**
* Called before the location changes
*
* @param event the event
*/
@Override
public void changing(LocationEvent event) {
// Show the location that's loading
// System.out.println("Loading " + event.location + "...");
}
/**
* Called after the location changes
*
* @param event the event
*/
@Override
public void changed(LocationEvent event) {
// Show the loaded location
// System.out.println("loaded location : " + event.location);
/* if (event.location.contains("/callback?type=google")) {
display.timerExec(2000, new Runnable() {
public void run() {
if (!shell.isDisposed()) {
shell.dispose();
}
display.dispose();
}
});
}*/
}
}
}
I'm using the following software:
Libreoffice 3.4
openJDK 6
Linux 3.1.2-1-desktop i686
System: openSUSE 11.4 (i586)
KDE: 4.6.00 (4.6.0) "release 6"
--
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs