Closed Bug 1240659 Opened 4 years ago Closed 4 years ago

Add GonkNativeHandle::CreateDupNhObj()

Categories

(Core :: Graphics: Layers, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla46
Tracking Status
firefox46 --- fixed

People

(Reporter: sotaro, Assigned: sotaro)

References

Details

Attachments

(1 file, 4 obsolete files)

GonkNativeHandle expects that it always owns fd of native_handle_t. But there is a case that the assumption is not met. To handle the case, it seems better to add a function that just dups a native_handle_t for GonkNativeHandle::NhObj.
Assignee: nobody → sotaro.ikeda.g
Blocks: 1234472
Attachment #8709269 - Flags: review?(nical.bugzilla)
Attachment #8709269 - Flags: review?(nical.bugzilla)
Add error handling.
Attachment #8709269 - Attachment is obsolete: true
Attachment #8709303 - Attachment is obsolete: true
correct patch.
Attachment #8709304 - Attachment is obsolete: true
Attachment #8709305 - Flags: review?(nical.bugzilla)
Comment on attachment 8709305 [details] [diff] [review]
patch - Add GonkNativeHandle::CreateDupNhObj()

Review of attachment 8709305 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/layers/ipc/GonkNativeHandle.cpp
@@ +42,5 @@
>  
>  already_AddRefed<GonkNativeHandle::NhObj>
>  GonkNativeHandle::GetDupNhObj()
>  {
> +  return GonkNativeHandle::CreateDupNhObj(mNhObj->mHandle);

IsValid() checks (mNhObj && mNhObj->mHandle). Does this mean that you may run in a crash if mNhObj is null here?
(In reply to Nicolas Silva [:nical] from comment #5)
> Comment on attachment 8709305 [details] [diff] [review]
> patch - Add GonkNativeHandle::CreateDupNhObj()
> 
> Review of attachment 8709305 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: gfx/layers/ipc/GonkNativeHandle.cpp
> @@ +42,5 @@
> >  
> >  already_AddRefed<GonkNativeHandle::NhObj>
> >  GonkNativeHandle::GetDupNhObj()
> >  {
> > +  return GonkNativeHandle::CreateDupNhObj(mNhObj->mHandle);
> 
> IsValid() checks (mNhObj && mNhObj->mHandle). Does this mean that you may
> run in a crash if mNhObj is null here?

Oh, sorry it is my mistake. I am going to update the patch. It should not crash.
Attachment #8709305 - Attachment is obsolete: true
Attachment #8709305 - Flags: review?(nical.bugzilla)
Attachment #8709744 - Flags: review?(nical.bugzilla)
Attachment #8709744 - Flags: review?(nical.bugzilla) → review+
https://hg.mozilla.org/mozilla-central/rev/a24d6c2b7525
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
You need to log in before you can comment on or make changes to this bug.