Last Comment Bug 44774 - When CurrentPage/selectAll() is invoked and no URL is loaded, then JVM crashes
: When CurrentPage/selectAll() is invoked and no URL is loaded, then JVM crashes
: crash
Product: Core Graveyard
Classification: Graveyard
Component: Java APIs to WebShell (show other bugs)
: Trunk
: x86 Windows NT
P3 critical (vote)
: ---
Assigned To: Ashu Kulkarni
: geetha.vaidyanaathan
Depends on:
  Show dependency treegraph
Reported: 2000-07-07 05:59 PDT by Oleg Khokhlov
Modified: 2012-04-09 22:27 PDT (History)
4 users (show)
See Also:
QA Whiteboard:
Iteration: ---
Points: ---

diffs in CurrentPageImpl.cpp and jni_util.h (1.78 KB, patch)
2000-07-24 14:18 PDT, Ashu Kulkarni
no flags Details | Diff | Splinter Review

Description User image Oleg Khokhlov 2000-07-07 05:59:27 PDT
When selectAll() is invoked and no URL is loaded, then JVM crashes:

###!!! ASSERTION: You can't dereference a NULL nsCOMPtr with operator->        
().: 'mRawPtr != 0', file ..\..\..\dist\include\nsCOMPtr.h, line 625

# HotSpot Virtual Machine Error, EXCEPTION_ACCESS_VIOLATION
# Error ID: 4F533F57494E13120E43505002B7

abnormal program termination

Build Date & Platform:
Mozilla M16, Webclient source from July,7; WinNT 4.0 with SP4
Comment 1 User image leger 2000-07-10 05:23:23 PDT
Adding crash keyword.
Comment 2 User image edburns 2000-07-21 12:15:25 PDT
selectAll is Ashu's.
Comment 3 User image Ashu Kulkarni 2000-07-24 14:18:57 PDT
Created attachment 11829 [details] [diff] [review]
diffs in CurrentPageImpl.cpp and jni_util.h
Comment 4 User image Ashu Kulkarni 2000-07-24 14:19:56 PDT
Checked in fix. Pls see attachment for patch
Comment 5 User image Oleg Khokhlov 2000-08-02 01:01:22 PDT
JVM still crashes.

Possible solution:

in string "rv = initContext->docShell->GetContentViewer(&contentViewer);" method 
GetContentViewer(&contentViewer) always returns NS_OK and rv is always 0.
So we need to check contentViewer value not rv.
We need to change string  "if (NS_FAILED(rv)) {" with string "if 
(contentViewer==nsnull) {".

I tested it and it works. Thanks.
Comment 6 User image Ashu Kulkarni 2000-08-02 09:58:53 PDT
Checked in fix suggested by Oleg. Tested it and confirmed that it works fine.
thanks Oleg.

cvs diff CurrentPageImpl.cpp (in directory D:\M16
Index: CurrentPageImpl.cpp
RCS file: /cvsroot/mozilla/java/webclient/src_moz/CurrentPageImpl.cpp,v
retrieving revision 1.9
diff -r1.9 CurrentPageImpl.cpp
<     if (NS_FAILED(rv))  {
>     if (NS_FAILED(rv) || contentViewer==nsnull )  {
<         if (NS_FAILED(rv))  {
>         if (NS_FAILED(rv) || contentViewer==nsnull)  {

*****CVS exited normally with code 1*****

Comment 7 User image Oleg Khokhlov 2001-09-04 00:56:04 PDT
I mark it as verified.

Note You need to log in before you can comment on or make changes to this bug.