diff options
author | Grant Gayed <ggayed> | 2009-05-06 19:49:49 +0000 |
---|---|---|
committer | Grant Gayed <ggayed> | 2009-05-06 19:49:49 +0000 |
commit | 775da6817f1330155074a54fdd00170b592382a6 (patch) | |
tree | 579fa5714e50edf7d0af3fbd06baf03bd0802535 | |
parent | bca4f4e5b14d2f7f838d8ebce6fe0befab8bb099 (diff) | |
download | eclipse.platform.swt-775da6817f1330155074a54fdd00170b592382a6.tar.gz eclipse.platform.swt-775da6817f1330155074a54fdd00170b592382a6.tar.xz eclipse.platform.swt-775da6817f1330155074a54fdd00170b592382a6.zip |
275207 - crash when showing text entry prompter
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptService2.java | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptService2.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptService2.java index f6f17f9b2a..174a356b23 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptService2.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/PromptService2.java @@ -317,37 +317,35 @@ int Prompt (int /*long*/ aParent, int /*long*/ aDialogTitle, int /*long*/ aText, * User selected OK. User name and password are returned as PRUnichar values. Any default * value that we override must be freed using the nsIMemory service. */ - int cnt, size; - int /*long*/ ptr; - char[] buffer; - int /*long*/[] result2 = new int /*long*/[1]; if (valueLabel[0] != null) { - cnt = valueLabel[0].length (); - buffer = new char[cnt + 1]; + int /*long*/[] result2 = new int /*long*/[1]; + int rc = XPCOM.NS_GetServiceManager (result2); + if (rc != XPCOM.NS_OK) SWT.error (rc); + if (result2[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE); + + nsIServiceManager serviceManager = new nsIServiceManager (result2[0]); + result2[0] = 0; + byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); + rc = serviceManager.GetServiceByContractID (aContractID, nsIMemory.NS_IMEMORY_IID, result2); + if (rc != XPCOM.NS_OK) SWT.error (rc); + if (result2[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE); + serviceManager.Release (); + + nsIMemory memory = new nsIMemory (result2[0]); + result2[0] = 0; + + int cnt = valueLabel[0].length (); + char[] buffer = new char[cnt + 1]; valueLabel[0].getChars (0, cnt, buffer, 0); - size = buffer.length * 2; - ptr = C.malloc (size); + int size = buffer.length * 2; + int /*long*/ ptr = memory.Alloc (size); XPCOM.memmove (ptr, buffer, size); XPCOM.memmove (aValue, new int /*long*/[] {ptr}, C.PTR_SIZEOF); if (valueAddr[0] != 0) { - int rc = XPCOM.NS_GetServiceManager (result2); - if (rc != XPCOM.NS_OK) SWT.error (rc); - if (result2[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE); - - nsIServiceManager serviceManager = new nsIServiceManager (result2[0]); - result2[0] = 0; - byte[] aContractID = MozillaDelegate.wcsToMbcs (null, XPCOM.NS_MEMORY_CONTRACTID, true); - rc = serviceManager.GetServiceByContractID (aContractID, nsIMemory.NS_IMEMORY_IID, result2); - if (rc != XPCOM.NS_OK) SWT.error (rc); - if (result2[0] == 0) SWT.error (XPCOM.NS_NOINTERFACE); - serviceManager.Release (); - - nsIMemory memory = new nsIMemory (result2[0]); - result2[0] = 0; memory.Free (valueAddr[0]); - memory.Release (); } + memory.Release (); } } if (aCheckState != 0) XPCOM.memmove (aCheckState, check, 4); |