Re: maybe a bug



On Sat, 2019-05-04 at 09:47 +0430, Vahid Bashiri via dia-list wrote:
Hi all

I made a skim of file "diagram.c" and in the function diagram_selected_break_external there are little things that might lead to erroneous behavior in case that multiple objects connected to single connection point. I am not sure about it being a bug so I am posting here in case someone take a closer look.
- line 708 "break; /* Not connected */"
after finding first unconnected object it doesn't go on with other objects connected to that CP.
I think a "continue" might solve the problem.
-line 750 "list = g_list_next(list);"
need to run only if the previous "if" statement doesn't run because we modify the list with
g_list_previous inside that "if" statement and the g_list_next
will result in skipping some objects on the list. It looks like an "else" might solve the problem.


I'm not completely sure what your saying here and GitLab would be a better venue, but here goes

You seem to be concerned we are breaking out of a loop to soon, but I don't thing we do:


[...]
698 list = dia->data->selected;
699 while (list != NULL) { <- I think this is the loop you think we are breaking out of, which would be bad
700 obj = (DiaObject *)list->data;
701
702 /* Break connections between this object and objects not selected: */
703 for (i=0;i<obj->num_handles;i++) { <- But we are actually breaking out of this loop
704 ConnectionPoint *con_point;
705 con_point = obj->handles[i]->connected_to;
706
707 if ( con_point == NULL )
708 break; /* Not connected */ <- Break works on both for and while loops
709
710 other_obj = con_point->object; <- If we didn't break this would SEGFAULT
[...]
717 }
[...]
750 list = g_list_next(list);
751 }
[...]

It's quite likely I've completely misunderstood your message though

_______________________________________________
dia-list mailing list
dia-list gnome org

https://nam02.safelinks.protection.outlook.com/?url="">

FAQ at 
https://nam02.safelinks.protection.outlook.com/?url="">

Main page at 
https://nam02.safelinks.protection.outlook.com/?url="">


-- 
Zander Brown <zbrown gnome org>
GNOME Design Tooling (Icon Preview)
Dia Diagram Editor

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]