Crash when using GPtrArray with Dbus

NayaN kumar nayankk at gmail.com
Wed Jul 29 05:10:47 PDT 2009


Hi Naveen,

Thanks for you suggestion. But, gptr_all_dls is been assigned to *gptrAllDls
before returning from the function. Hence, pointer to gptr_all_dls (which is
stored in *gptrAllDls) doesn't go out of scope after this function call.

Also, I tested the changed code as per your suggestion, but still the crash
is seen.

On Wed, Jul 29, 2009 at 4:47 PM, Naveen Verma <ernaveenverma at gmail.com>wrote:

>
>
>
>>
>> gboolean
>> downloadDaemonGetAllDownloads(DownloadDaemon* DaemonObject,
>>                               GPtrArray** gptrAllDls,
>>                               GError** error)
>> {
>>     GPtrArray* gptr_all_dls = g_ptr_array_sized_new(1);
>
> -- You should directly initialize *gptrAIIDIs here, then add the member in
> this, because the above gptr_all_dlls in stack and become out of scope after
> this function call.
>
>
>>
>>     gptr_all_dls->len = numDls;
>
> -- You don't need to set the length its dynamic array.
>
>>
>>
>>      g_ptr_array_add(gptr_all_dls,(gpointer)(1234567));
>
> -- you can use GUINT_TO_POINTER(123456)
>
>>
>>
>>     *gptrAllDls = gptr_all_dls;
>>
>>     return TRUE;
>> }
>> -Br
>
> Naveen
>
>
>>
>> _______________________________________________
>> dbus mailing list
>> dbus at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dbus
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/dbus/attachments/20090729/70cf2110/attachment.htm 


More information about the dbus mailing list