Closed Bug 296823 Opened 19 years ago Closed 19 years ago

[BEOS] nsWindow::SetTitle should check if mView is NULL

Categories

(Core Graveyard :: Widget: BeOS, defect)

x86
BeOS
defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: thesuckiestemail, Assigned: thesuckiestemail)

References

Details

(Keywords: fixed1.8)

Attachments

(1 file, 1 obsolete file)

User-Agent:       Mozilla/5.0 (BeOS; U; BeOS BePC; en-US; rv:1.8b2) Gecko/20050605 Firefox/1.0+
Build Identifier: 

if(text && mView->LockLooper())
should be 
if(text && mView!=NULL && mView->LockLooper())

Reproducible: Always
Status: NEW → ASSIGNED
Attached patch checks if mView is NULL (obsolete) — Splinter Review
r?
Assignee: beos → thesuckiestemail
Attachment #185466 - Flags: review?(sergei_d)
Comment on attachment 185466 [details] [diff] [review]
checks if mView is NULL

r=sergei_d

though, maybe it is better to keep unified style (which i personally dislike,
btw) when we use:
mView && mView->LockLooper()
everywhere.
With "explicit" comparison better style is classicaly:
NULL != mView (in order to keep it in style with 
NULL == pointer - this last one prevents error when comparison is mistakenly
replaced with assignment)
Attachment #185466 - Flags: review?(sergei_d) → review+
Blocks: 296856
Blocks: 266252
tqh, what do you think about this version:
NS_METHOD nsWindow::SetTitle(const nsAString& aTitle)
{
	const char *text = ToNewUTF8String(aTitle);
	if(NULL == text)
		return NS_ERROR_FAILURE;
	if(mView && mView->LockLooper())
	{
		mView->Window()->SetTitle(text);
		mView->UnlockLooper();
	}
	delete [] text;
	return NS_OK;
}

Look more in style, don't bother with deleting text if it is NULL.
Only thing which is bit unclear for me - should we return generic
NS_ERROR_FAILURE or NS_ERROR_OUT_OF_MEMORY;
in case of no text
Looks good. Shouldn't NS_ERROR_FAILURE be more appropriate. 
delete[] is not a pair for ToNewUTF8String.

if you just need an auto, try:
NS_ConvertUTF16toUTF8(aTitle).get()
ready to commit?
Attachment #195882 - Flags: review?(sergei_d)
Comment on attachment 195882 [details] [diff] [review]
a cleaner implementation

r=sergei_d
Attachment #195882 - Flags: review?(sergei_d) → review+
Comment on attachment 185466 [details] [diff] [review]
checks if mView is NULL

obsoleting
Attachment #185466 - Attachment is obsolete: true
checked in
2005-09-13 13:13 Rev. 1.94 	
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Shouldn't this bug also be fixed in the MOZILLA_1_8_BRANCH?
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Requesting permission for the MOZILLA_1_8_BRANCH.

BeOS-only change, will have no effect whatsoever on other plaforms. 
Flags: blocking1.8b5?
please request approvals to land in the patch, not with the blocking flag.
Flags: blocking1.8b5?
Attachment #195882 - Flags: approval1.8b5?
Sorry, I realised this error when I was lying in bed just now. You fixed it
before me. 
Probably not, but since our BeOS Firefox 1.5 tracker depends on this bug, it
keeps  it clear which bugs are fixed for the release and which are not.
Flags: blocking1.8b5+
Attachment #195882 - Flags: approval1.8b5? → approval1.8b5+
Fixed on MOZILLA_1_8_BRANCH.

Checking in nsWindow.cpp;
/cvsroot/mozilla/widget/src/beos/nsWindow.cpp,v  <--  nsWindow.cpp
new revision: 1.91.4.2; previous revision: 1.91.4.1
Status: REOPENED → RESOLVED
Closed: 19 years ago19 years ago
Keywords: fixed1.8
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: