Last Comment Bug 44775 - When copyCurrentSelectionToSystemClipboard() method is invoked and no URL is loaded, then JVM crashes
: When copyCurrentSelectionToSystemClipboard() method is invoked and no URL is ...
Status: VERIFIED FIXED
: 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
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2000-07-07 06:05 PDT by Oleg Khokhlov
Modified: 2012-04-09 22:27 PDT (History)
4 users (show)
See Also:
QA Whiteboard:
Iteration: ---
Points: ---


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

Description Oleg Khokhlov 2000-07-07 06:05:38 PDT
When copyCurrentSelectionToSystemClipboard() method 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 leger 2000-07-10 05:23:37 PDT
Adding crash keyword.
Comment 2 edburns 2000-07-21 12:16:32 PDT
Ashu
Comment 3 Ashu Kulkarni 2000-07-21 12:36:44 PDT
The nsIContentViewerEdit component is absent when no URL is loaded. Was fixed
easily by checking if this is null before making calls to SelectAll or
CopySelectionToClipboard.

Will check in changes on Monday, since the office is unusable today and I dont
have CVS on my home PC.

_Ashu
Comment 4 Ashu Kulkarni 2000-07-24 14:22:03 PDT
Created attachment 11830 [details] [diff] [review]
diffs in CurrentPageIMpl.cpp and jni_util.h
Comment 5 Ashu Kulkarni 2000-07-24 14:23:34 PDT
Checked in Fix. Pls see attachment for patch. Code checks for ContentViewer to 
be non-null before issuing CopyCurrentSelectionToSystemClipboard call
Comment 6 Oleg Khokhlov 2000-08-02 00:59:57 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 7 Ashu Kulkarni 2000-08-02 09:59:49 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
\mozilla\java\webclient\src_moz)
Index: CurrentPageImpl.cpp
===================================================================
RCS file: /cvsroot/mozilla/java/webclient/src_moz/CurrentPageImpl.cpp,v
retrieving revision 1.9
diff -r1.9 CurrentPageImpl.cpp
74c74
<     if (NS_FAILED(rv))  {
---
>     if (NS_FAILED(rv) || contentViewer==nsnull )  {
339c339
<         if (NS_FAILED(rv))  {
---
>         if (NS_FAILED(rv) || contentViewer==nsnull)  {

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

_Ashu
Comment 8 Oleg Khokhlov 2001-09-04 00:57:06 PDT
I mark it as verified.

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