Created attachment 334243
Christopher's version with test and Assign
(In reply to comment #17)
> >+ gchar *colorString = gdk_color_to_string(&color);
> >+ aResult.Adopt(colorString);
> >+ g_free(colorString);
>
> Shouldn't you copy the string here?
yeah, adopting doesn't look right according to the comment in ./string/public/nsXPCOMStrings.h:
/* Data passed into NS_StringContainerInit2 is not copied; instead, the
* string takes ownership over the data pointer. The caller must have
* allocated the data array using the XPCOM memory allocator (nsMemory).
* This flag should not be combined with NS_STRING_CONTAINER_INIT_DEPEND. */
NS_STRING_CONTAINER_INIT_ADOPT = (1 << 2),
And I'm getting glibc double free errors with it. I've replaced it with Assign and added the tests.
Created attachment 334243
Christopher's version with test and Assign
(In reply to comment #17) to_string( &color) ; Adopt(colorStri ng); colorString) ;
> >+ gchar *colorString = gdk_color_
> >+ aResult.
> >+ g_free(
>
> Shouldn't you copy the string here?
yeah, adopting doesn't look right according to the comment in ./string/ public/ nsXPCOMStrings. h: nerInit2 is not copied; instead, the CONTAINER_ INIT_DEPEND. */ CONTAINER_ INIT_ADOPT = (1 << 2),
/* Data passed into NS_StringContai
* string takes ownership over the data pointer. The caller must have
* allocated the data array using the XPCOM memory allocator (nsMemory).
* This flag should not be combined with NS_STRING_
NS_STRING_
And I'm getting glibc double free errors with it. I've replaced it with Assign and added the tests.