I have a very benign looking method in my component.  In the idl file it
looks like this:
    void Bar(in string one, out string two);
In the .cpp it looks like this:
    NS_IMETHODIMP Foo::Bar(const char *one, char **two)
    {
        NS_PRECONDITION(two, "null ptr");
        // ...
        *two = anything;
    }
This consistantly causes a lot of thrashing at the access of *two, followed
by an EXC_BAD_ACCESS (crash log posted below).

Now I realize that one must be careful here, and I follow
[EMAIL PROTECTED]'s advice in www.mozilla.org/scriptable/faq.html and use
nsMemory::Clone(), successfully, to clone the locally-allocated var into
XPCOM/global memory. The problem really seems to be with the state of the
param as it's passed in originally.  I'm calling this component from
JavaScript code, where I've tried a number of things: return values, 2 args,
return to temp vs. real variable, etc.  Note that all of my other methods,
with "in" parameters only, behave beautifully.  It's only this method with
the "out" parameter that has any problem.  Note that I'm working with the
CHIMERA_M1_0_1_BRANCH branch.

Thanks in advance for any help,
Michael
**********

Date/Time: 2003-02-06 19:20:55 -0800

OS Version: 10.2.3 (Build 6G30)

Host: J-Michael-Caines-Computer.local.

Command: Navigator

PID: 2340

Exception: EXC_BAD_ACCESS (0x0001)

Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000001

Thread 0 Crashed:

#0 0x22f1f70c in AWebCom::EditTicket(char const*, char**) (WebCom.cpp:140)

#1 0x01853e6c in _XPTC_InvokeByIndex (xptcstubs_ppc_rhapsody.cpp:256)

#2 0x018531a4 in XPTC_InvokeByIndex (xptcinvoke_ppc_rhapsody.cpp:144)

#3 0x045b7598 in XPCWrappedNative::CallMethod(XPCCallContext&,
XPCWrappedNative::CallMode) (xpcwrappednative.cpp:2025)

#4 0x045c0774 in XPC_WN_CallMethod(JSContext*, JSObject*, unsigned, long*,
long*) (xpcwrappednativejsops.cpp:1266)

#5 0x02eaf460 in js_Invoke (jsinterp.c:838)

#6 0x02ec0450 in js_Interpret (jsinterp.c:2791)

#7 0x02eafd90 in js_Execute (jsinterp.c:1018)

#8 0x02e6f2d8 in JS_EvaluateUCScriptForPrincipals (jsapi.c:3382)

#9 0x159dd938 in nsJSContext::EvaluateString(nsAString const&, void*,
nsIPrincipal*, char const*, unsigned, char const*, nsAString&, int*)
(nsJSEnvironment.cpp:669)

#10 0x22feb0cc in nsJSThunk::EvaluateScript() (nsJSProtocolHandler.cpp:277)

#11 0x22fec8f0 in nsJSChannel::AsyncOpen(nsIStreamListener*, nsISupports*)
(nsJSProtocolHandler.cpp:619)

#12 0x08ac8cf4 in nsDocumentOpenInfo::Open(nsIChannel*, int, nsISupports*)
(nsURILoader.cpp:171)

#13 0x08acac34 in nsURILoader::OpenURIVia(nsIChannel*, int, nsISupports*,
unsigned) (nsURILoader.cpp:582)

#14 0x08aca9a0 in nsURILoader::OpenURI(nsIChannel*, int, nsISupports*)
(nsURILoader.cpp:542)

#15 0x1324a118 in nsDocShell::DoChannelLoad(nsIChannel*, nsIURILoader*)
(nsDocShell.cpp:5149)

#16 0x1324962c in nsDocShell::DoURILoad(nsIURI*, nsIURI*, nsISupports*,
nsIInputStream*, nsIInputStream*, int, nsIDocShell**, nsIRequest**)
(nsDocShell.cpp:4926)

#17 0x13248548 in nsDocShell::InternalLoad(nsIURI*, nsIURI*, nsISupports*,
int, unsigned short const*, nsIInputStream*, nsIInputStream*, unsigned,
nsISHEntry*, int, nsIDocShell**, nsIRequest**) (nsDocShell.cpp:4718)

#18 0x13253db8 in nsWebShell::OnLinkClickSync(nsIContent*, nsLinkVerb,
unsigned short const*, unsigned short const*, nsIInputStream*,
nsIInputStream*, nsIDocShell**, nsIRequest**) (nsWebShell.cpp:608)

#19 0x132a7e8c in OnLinkClickEvent::HandleEvent() (nsWebShell.cpp:462)

#20 0x13253334 in HandlePLEvent(OnLinkClickEvent*) (nsWebShell.cpp:476)

#21 0x01822738 in PL_HandleEvent (plevent.c:596)

#22 0x018224e0 in PL_ProcessPendingEvents (plevent.c:527)

#23 0x01824d54 in nsEventQueueImpl::ProcessPendingEvents()
(nsEventQueue.cpp:392)

#24 0x1422754c in -[EventQueueHandler eventTimer:] (nsToolkit.mm:206)

#25 0x907e521c in __NSFireTimer

#26 0x901632f0 in __CFRunLoopDoTimer

#27 0x90148e48 in __CFRunLoopRun

#28 0x90180fe4 in CFRunLoopRunSpecific

#29 0x969a36a0 in RunCurrentEventLoopInMode

#30 0x969b34c8 in ReceiveNextEventCommon

#31 0x969da584 in BlockUntilNextEventMatchingListInMode

#32 0x9308d8ac in _DPSNextEvent

#33 0x9309fb04 in -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:]

#34 0x930b15e4 in -[NSApplication run]

#35 0x9315f6b8 in NSApplicationMain

#36 0x0000311c in main (main.m:53)

#37 0x00002e18 in _start (crt.c:267)

#38 0x00002c98 in start

Thread 1:

#0 0x900257ac in select

#1 0x00db9970 in poll (unix.c:3640)

#2 0x00db3394 in _pr_poll_with_poll (ptio.c:3826)

#3 0x00db371c in PR_Poll (ptio.c:4202)

#4 0x05e4a3f4 in nsSocketTransportService::Run()
(nsSocketTransportService.cpp:485)

#5 0x01827644 in nsThread::Main(void*) (nsThread.cpp:120)

#6 0x00db5618 in _pt_root (ptthread.c:217)

#7 0x90020d48 in _pthread_body

Thread 2:

#0 0x9003eaa8 in semaphore_wait_signal_trap

#1 0x9003e8c4 in _pthread_cond_wait

#2 0x00dac334 in PR_WaitCondVar (ptsynch.c:389)

#3 0x05e5cce4 in nsDNSService::DequeuePendingQ() (nsDnsService.cpp:1575)

#4 0x05e5c3f0 in nsDNSService::Run() (nsDnsService.cpp:1374)

#5 0x01827644 in nsThread::Main(void*) (nsThread.cpp:120)

#6 0x00db5618 in _pt_root (ptthread.c:217)

#7 0x90020d48 in _pthread_body

Thread 3:

#0 0x90042688 in semaphore_timedwait_signal_trap

#1 0x9003e8b4 in _pthread_cond_wait

#2 0x00dabcb4 in pt_TimedWait (ptsynch.c:264)

#3 0x00dac35c in PR_WaitCondVar (ptsynch.c:391)

#4 0x0182eddc in TimerThread::Run() (TimerThread.cpp:330)

#5 0x01827644 in nsThread::Main(void*) (nsThread.cpp:120)

#6 0x00db5618 in _pt_root (ptthread.c:217)

#7 0x90020d48 in _pthread_body

Thread 4:

#0 0x90073c48 in mach_msg_trap

#1 0x90005f90 in mach_msg

#2 0x928ec28c in JNI_CreateJavaVM_Impl

#3 0x928ec224 in JNI_CreateJavaVM_Impl

#4 0x928a51fc in JVM_GetClassMethodsCount

#5 0x90020d48 in _pthread_body

Thread 5:

#0 0x90073c48 in mach_msg_trap

#1 0x90005f90 in mach_msg

#2 0x9283de9c in JVM_NewInstance

#3 0x9285eae4 in JVM_FillInStackTrace

#4 0x928647a0 in JVM_Send

#5 0x9290114c in JNI_CreateJavaVM_Impl

#6 0x928a51fc in JVM_GetClassMethodsCount

#7 0x90020d48 in _pthread_body

Thread 6:

#0 0x90073c48 in mach_msg_trap

#1 0x90005f90 in mach_msg

#2 0x9283ddf4 in JVM_NewInstance

#3 0x92845d80 in JVM_ArrayCopy

#4 0x9285d620 in JVM_MonitorNotify

#5 0x9285e2f8 in JVM_MonitorWait

#6 0x17d4b668 in 0x17d4b668

#7 0x17d4968c in 0x17d4968c

#8 0x17d4968c in 0x17d4968c

#9 0xa2843c38 in typeinfo name for std::bad_exception

#10 0x92838bdc in JVM_CurrentTimeMillis

#11 0x92878c28 in JVM_FindClassFromClass

#12 0x92892c90 in JVM_IsSameClassPackage

#13 0x9288cf70 in JVM_GetMethodIxExceptionTableEntry

#14 0x928787a0 in JVM_FindClassFromClass

#15 0x928a51fc in JVM_GetClassMethodsCount

#16 0x90020d48 in _pthread_body

Thread 7:

#0 0x90073c48 in mach_msg_trap

#1 0x90005f90 in mach_msg

#2 0x9283ddf4 in JVM_NewInstance

#3 0x92845d80 in JVM_ArrayCopy

#4 0x9285d620 in JVM_MonitorNotify

#5 0x9285e2f8 in JVM_MonitorWait

#6 0x17d4b668 in 0x17d4b668

#7 0x17d4968c in 0x17d4968c

#8 0x17d495cc in 0x17d495cc

#9 0x17d495cc in 0x17d495cc

#10 0xa2843c38 in typeinfo name for std::bad_exception

#11 0x92838bdc in JVM_CurrentTimeMillis

#12 0x92878c28 in JVM_FindClassFromClass

#13 0x92892c90 in JVM_IsSameClassPackage

#14 0x9288cf70 in JVM_GetMethodIxExceptionTableEntry

#15 0x928787a0 in JVM_FindClassFromClass

#16 0x928a51fc in JVM_GetClassMethodsCount

#17 0x90020d48 in _pthread_body

Thread 8:

#0 0x90073c48 in mach_msg_trap

#1 0x90005f90 in mach_msg

#2 0x9283de9c in JVM_NewInstance

#3 0x92844e18 in JVM_GetClassLoader

#4 0x92844ba4 in JVM_GetClassLoader

#5 0x928a51fc in JVM_GetClassMethodsCount

#6 0x90020d48 in _pthread_body

Thread 9:

#0 0x90073c48 in mach_msg_trap

#1 0x90005f90 in mach_msg

#2 0x9283ddf4 in JVM_NewInstance

#3 0x9285eb40 in JVM_FillInStackTrace

#4 0x92903300 in JVM_InitProperties

#5 0x92903138 in JVM_InitProperties

#6 0x928787a0 in JVM_FindClassFromClass

#7 0x928a51fc in JVM_GetClassMethodsCount

#8 0x90020d48 in _pthread_body

Thread 10:

#0 0x90073c48 in mach_msg_trap

#1 0x90005f90 in mach_msg

#2 0x9283ddf4 in JVM_NewInstance

#3 0x9285eb40 in JVM_FillInStackTrace

#4 0x9288890c in JVM_StartThread

#5 0x92876c10 in JVM_FindLoadedClass

#6 0x928787a0 in JVM_FindClassFromClass

#7 0x928a51fc in JVM_GetClassMethodsCount

#8 0x90020d48 in _pthread_body

Thread 11:

#0 0x9003eaa8 in semaphore_wait_signal_trap

#1 0x9003e8c4 in _pthread_cond_wait

#2 0x90824180 in -[NSConditionLock lockWhenCondition:]

#3 0x93081388 in -[NSUIHeartBeat _heartBeatThread:]

#4 0x9081cd38 in forkThreadForFunction

#5 0x90020d48 in _pthread_body

Thread 12:

#0 0x9003eaa8 in semaphore_wait_signal_trap

#1 0x9003e8c4 in _pthread_cond_wait

#2 0x00dac334 in PR_WaitCondVar (ptsynch.c:389)

#3 0x018298c8 in nsThreadPool::GetRequest(nsIThread*) (nsThread.cpp:671)

#4 0x0182ab64 in nsThreadPoolRunnable::Run() (nsThread.cpp:910)

#5 0x01827644 in nsThread::Main(void*) (nsThread.cpp:120)

#6 0x00db5618 in _pt_root (ptthread.c:217)

#7 0x90020d48 in _pthread_body

PPC Thread State:

srr0: 0x22f1f70c srr1: 0x0000f030 vrsave: 0x00000000

xer: 0x00000000 lr: 0x22f1f704 ctr: 0x00000000 mq: 0x00000000

r0: 0xbfffcce0 r1: 0xbfffcc40 r2: 0x0000052c r3: 0xbfffcce0

r4: 0x22f2a6d4 r5: 0x00000024 r6: 0x6e674100 r7: 0xdd0d5950

r8: 0x00000000 r9: 0x00000001 r10: 0x22a55970 r11: 0x900f94f0

r12: 0xbfffcd04 r13: 0x00000000 r14: 0x00000000 r15: 0x00000001

r16: 0x00000001 r17: 0x00000000 r18: 0x24002420 r19: 0x00000000

r20: 0x0000c18f r21: 0x00000000 r22: 0x00c54170 r23: 0x00c54278

r24: 0x00000001 r25: 0x02aa8b28 r26: 0x16710ca0 r27: 0x039b1af0

r28: 0x00000000 r29: 0x00ec5280 r30: 0xbfffcc40 r31: 0x22f1f540



Reply via email to