[IGSTK-Users] Segmentation Fault when Adding and Removing objects

Matt Turek matt.turek at kitware.com
Tue Jan 15 15:08:46 EST 2008



Vincent,

Luis, Andinet, and I looked into the bug you submitted and we think we 
have a fix.

There was an issue when an igstk::ObjectRepresentation was deleted. An 
event transduction macro in igstk::ObjectRepresentation had created an 
observer that was still attached to the igstk::SpatialObject, even after 
the igstk::ObjectRepresentation was deleted. This caused a crash when 
the igstk::SpatialObject tried to invoke the callback in the deleted 
igstk::ObjectRepresentation.

Luis has checked in changes in igstkMacros.h, igstkObject.h, and 
igstkObject.cxx that should fix the problem. Now, an igstk::Object 
maintains a list of observed objects and observer tags and cleans up its 
observer callbacks when igstk::Object is destroyed. 
RemoveFromObservedObjects() in igstk::Object::~Object() carries out the 
cleanup.

We have also checked in a test, igstkObjectRepresentationRemovalTest, in 
Sandbox/Testing that reproduced the problem.

Would you update your source, rebuild, and verify that we've fixed the 
crash?

Thanks again for another great bug report. The example you provided was 
a huge help.

Thanks,
Matt






Andinet Enquobahrie wrote:
> Hi Vincent,
>
> This is to acknowledge that I was able to build your small example and
> reproduce your problem.  I will look into and get back to you.
>
> Thanks for providing the small example.
>
> -Andinet
>
>> Hi igstk-users,
>>
>> I am faced with a serious bug in my code, and I am not able to find 
>> where it comes from.
>>
>> When I add one (or some) representation(s) to a view, and next remove 
>> one (or some),  the program results in a segmentation fault.
>> An important point is that adding/removing must be made by the user, 
>> through the user interface.
>>
>> I tried to reproduce this bug in a simple example, in order to debug 
>> and understand it.
>> I attached the corresponding code inspired from the 
>> OneViewAndTrackingUsingQtWidget example.
>>
>> Please let me know if I made any mistake, or if you don't understand 
>> something in my code.
>>
>> Thank you and have a nice day,
>>
>> Vincent
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> IGSTK-Users mailing list
>> IGSTK-Users at public.kitware.com
>> http://public.kitware.com/cgi-bin/mailman/listinfo/igstk-users
>>
>
>


-- 
Matt Turek, Ph.D.
R&D Engineer
Kitware, Inc.
28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x142
email: Matt.Turek at kitware.com




More information about the IGSTK-Users mailing list