After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 391646 - cc_circle_set_radius calls cc_item_dirty with NULL view
cc_circle_set_radius calls cc_item_dirty with NULL view
Status: RESOLVED FIXED
Product: criawips
Classification: Deprecated
Component: Canvas (libccc)
0.0.x
Other All
: Normal critical
: ---
Assigned To: Criawips maintainers
Criawips maintainers
: 432606 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2007-01-01 21:01 UTC by Canek Peláez Valdés
Modified: 2007-05-04 16:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Example; triggers the bug (1.62 KB, text/plain)
2007-01-01 21:03 UTC, Canek Peláez Valdés
  Details
Proposed patch (793 bytes, patch)
2007-01-01 21:06 UTC, Canek Peláez Valdés
needs-work Details | Review
cc_item_dirty takes a NULL view (2.88 KB, patch)
2007-01-04 01:42 UTC, Canek Peláez Valdés
none Details | Review

Description Canek Peláez Valdés 2007-01-01 21:01:45 UTC
Steps to reproduce:
1. Appenda a CcCircle* c to a CcItem* i
2. Change the radius of c with cc_circle_set_radius(c, whatever)
3. The aplication segfaults


Stack trace:
  • #0 cvw_set_dirty
    at cc-view-widget.c line 121
  • #1 cvw_item_dirty
    at cc-view-widget.c line 914
  • #2 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #3 g_signal_chain_from_overridden
    from /usr/lib/libgobject-2.0.so.0
  • #4 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #5 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #6 cc_item_dirty
    at cc-item.c line 236
  • #7 ci_item_dirty
    at cc-item.c line 1194
  • #8 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #9 g_signal_chain_from_overridden
    from /usr/lib/libgobject-2.0.so.0
  • #10 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #11 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #12 cc_item_dirty
    at cc-item.c line 236
  • #13 ci_item_dirty
    at cc-item.c line 1194
  • #14 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #15 g_signal_chain_from_overridden
    from /usr/lib/libgobject-2.0.so.0
  • #16 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #17 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #18 cc_item_dirty
    at cc-item.c line 236
  • #19 cc_circle_set_radius
    at cc-circle.c line 68
  • #20 main
    at bug.c line 51


Other information:
Using git repository as of Mon Jan  1 10:02:44 CST 2007.
Comment 1 Canek Peláez Valdés 2007-01-01 21:03:13 UTC
Created attachment 79153 [details]
Example; triggers the bug

This little example triggers the bug.
Comment 2 Canek Peláez Valdés 2007-01-01 21:06:04 UTC
Created attachment 79155 [details] [review]
Proposed patch

The segfaults occur because cc_item_dirty is called with a NULL view. The analogous function cc_circle_set_anchor doesn't call cc_item_dirty, so I propose to remove the call and leave it to the user to call cc_item_dirty (as cc_circle_set_anchor does).
Comment 3 Sven Herzberg 2007-01-02 17:55:13 UTC
We shouldn't leave that to the application developer. The point is that a canvas should be easily usable and I just forgot to implement the dirty stuff in the circle for these properties. The reason is that the canvas item implementation has got a far better knowledge of the region that has to be repainted than the application developer can imagine.

There are 2 ways of getting this right (and I prefer the first one):
1. Fix cc_item_dirty() to accept NULL views (and add g_return_if_fail(!view || CC_IS_VIEW(view))) and in case of a NULL view, call emit dirty on all the views.

2. Fix cc_circle_set_*() to not segfault by calling the iteraton in the item implementation.
Comment 4 Canek Peláez Valdés 2007-01-04 01:42:27 UTC
Created attachment 79350 [details] [review]
cc_item_dirty takes a NULL view

I agree; the canvas should be easy to use. I modified cc_item_dirty so it can take a NULL  view; in that case it emits the dirty signal to all the views of the item.

I also modified the cc_circle_set_anchor function to call cc_item_dirty; I probed in the program I'm developing and so far it works.
Comment 5 Sven Herzberg 2007-04-20 14:43:21 UTC
I actually don't agree to the patch in cc-circle.c

update-bounds is supposed to make sure the bounding box gets updated.

So I proposed this way of getting it fixed:
1. Change cc_item_dirty() to also accept NULL (which the meaning of "the bounding box")
2. Change set_anchor() to call cc_item_dirty() (which NULL views and and NULL bbox) - this API will have to change when I rewrite the stuff to update BBoxes, Dirty regions etc. to be run async.
3. After cc_item_dirty() update the anchor point
4. Then update the bounding box
5. Then emit a new dirty event on the new bbox

Also, some tests for this behavior would be very nice in the test suite.
Comment 6 Sven Herzberg 2007-05-03 13:36:55 UTC
Canek, may I put the example that triggers the bug under the same license as the rest of the testing system?

http://beast.gtk.org/LICENSE-AS-ISh
Comment 7 Sven Herzberg 2007-05-03 13:42:43 UTC
*** Bug 432606 has been marked as a duplicate of this bug. ***
Comment 8 Sven Herzberg 2007-05-03 14:50:23 UTC
This bug is fixed in revision 4da4b3b9dc82d2360906cb8faf98c7da2ea7a07e on my master branch.

Closing this bug once the licensing for the test case is clear.
Comment 9 Canek Peláez Valdés 2007-05-03 20:50:02 UTC
Of course you can relicense the example; and all the code written by me related with CCC.
Comment 10 Sven Herzberg 2007-05-04 16:55:59 UTC
Great. Thanks a lot.