[interfacekit] Re: Broken BMessage

Well, I've been testing with the code below, and I haven't found any 
crashes.  I have found several bugs, however: a couple of memory leaks, 
and an incorrect index bounds check -- which shows up because the code 
below adds two items, and then tries to reference the third index (2). 
=)  So good stuff there.  I'm going to check the changes in and keep 
poking at it; please let me know if your crashes magically disappear. =)

Thanks,

e

>#include <Application.h>
>#include <Entry.h>
>#include <Message.h>
>
>static
>void
>IsAppPreRegistered()
>{
>       BMessage request;
>       entry_ref ref(0, 0, ".");
>       request.AddRef("ref", &ref);
>}
>
>void
>main()
>{
>       IsAppPreRegistered();
>       BMessage testTypes1;
>       testTypes1.AddString("types", 
>"application/x-vnd.obos.app-file-info-test1");
>       testTypes1.AddString("types", 
>"application/x-vnd.obos.app-file-info-test2");
>       const char *type;
>       testTypes1.FindString("types", 2, &type);
>}
>


Necessity is the plea for every infringement of human freedom. It is the 
argument of tyrants; it is the creed of slaves.
        -William Pitt, British prime-minister (1759-1806)


Other related posts: