Closed
Bug 656781
Opened 13 years ago
Closed 13 years ago
More efficient way to use g_app_info_launch_uris and gnome_vfs_mime_application_launch
Categories
(Toolkit :: General, defect)
Tracking
()
RESOLVED
FIXED
mozilla6
People
(Reporter: hiro, Assigned: hiro)
Details
Attachments
(1 file, 2 obsolete files)
1.99 KB,
patch
|
karlt
:
review+
|
Details | Diff | Splinter Review |
GList is dynamically allocated in the current implementation but because it is not needed because we have only one URI for those functions.
Assignee | ||
Comment 1•13 years ago
|
||
Comment on attachment 532046 [details] [diff] [review] A proposed patch The URI is not needed to duplicate in nsGIOMimeApp::Launch too.
Attachment #532046 -
Flags: review?(karlt)
Comment 2•13 years ago
|
||
Comment on attachment 532046 [details] [diff] [review] A proposed patch >+ uris.data = PromiseFlatCString(aUri).get(); The result of PromiseFlatCString::get() is only valid as long as the lifetime of the PromiseFlatCString. I expect you can PromiseFlatCString flatUri(aUri); uris.data = flatUri.get(); The rest looks good.
Attachment #532046 -
Flags: review?(karlt) → review-
Assignee | ||
Comment 3•13 years ago
|
||
> > The result of PromiseFlatCString::get() is only valid as long as the
> lifetime of the PromiseFlatCString.
> I expect you can
>
> PromiseFlatCString flatUri(aUri);
> uris.data = flatUri.get();
I did not know about the lifetime. Thank you very much!
Attachment #532046 -
Attachment is obsolete: true
Attachment #532104 -
Flags: review?(karlt)
Comment 4•13 years ago
|
||
Comment on attachment 532104 [details] [diff] [review] Revised patch >+ uris.data = (gpointer)flatUri.get(); r+ with the (gpointer) cast removed.
Attachment #532104 -
Flags: review?(karlt) → review+
Assignee | ||
Comment 5•13 years ago
|
||
(In reply to comment #4) > Comment on attachment 532104 [details] [diff] [review] [review] > Revised patch > > >+ uris.data = (gpointer)flatUri.get(); > > r+ with the (gpointer) cast removed. Compiler outputs an error without the case on my ubuntu 11.04 machine. toolkit/system/gnome/nsGIOService.cpp:140:27: error: invalid conversion from ‘const void*’ to ‘void*’
Comment 6•13 years ago
|
||
OK, thanks. How about const_cast<gpointer> or const_cast<char*>?
Assignee | ||
Comment 7•13 years ago
|
||
const_cast<gpointer> needs static_cast<void*> so I chose the latter.
Attachment #532104 -
Attachment is obsolete: true
Attachment #532113 -
Flags: review?(karlt)
Comment 8•13 years ago
|
||
Comment on attachment 532113 [details] [diff] [review] Use const_cast<char*> Thanks for sorting that out. I like const_cast because it is clearer why a cast is necessary. It's hard to tell from "(gpointer)" what transformation may be taking place.
Attachment #532113 -
Flags: review?(karlt) → review+
Assignee | ||
Comment 9•13 years ago
|
||
(In reply to comment #8) > Comment on attachment 532113 [details] [diff] [review] [review] > Use const_cast<char*> > > Thanks for sorting that out. > I like const_cast because it is clearer why a cast is necessary. > It's hard to tell from "(gpointer)" what transformation may be taking place. Ah, now I see your point.
Assignee: nobody → hiikezoe
Keywords: checkin-needed
Comment 10•13 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/a593b2b745ff
Status: NEW → RESOLVED
Closed: 13 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla6
Version: unspecified → Trunk
You need to log in
before you can comment on or make changes to this bug.
Description
•