Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mx-bin will remove and destroy the child actor/provide an api to unparent the child #67

Open
mmdemo opened this issue Oct 18, 2012 · 9 comments

Comments

@mmdemo
Copy link

mmdemo commented Oct 18, 2012

Actort1(MxBin)->Actor2(MxBin)->Actor3(container)
/Actor1 is a parent of Actor2/
mx_bin_set_child(MX_BIN(Actort1),Actor2);
/Actor2 is a parent of Actor3/
mx_bin_set_child(MX_BIN(Actort2),Actor3);

During the runtime i want to remove actor2 and Set Actor3 as a child of Actor1
Actort1(MxBin)->Actor3(container)
temp_actor = g_object_ref(Actor3);
clutter_actor_remove_child(Actort2,Actor3);
mx_bin_set_child(MX_BIN(Actort1),Actor3);

this is crashing!!! ,when i call mx_bin_set_child(MX_BIN(Actort1),Actor3);
how do i solve this..

@djdeath
Copy link
Contributor

djdeath commented Oct 18, 2012

We will need a bit more context here to understand your problem.
MxBin is an abstract class. What are the actually classes you're working with?

Also a backtrace would be useful.

@mmdemo
Copy link
Author

mmdemo commented Oct 18, 2012

Actort1(MxBin)->Actor2(MxBin)->Actor3(container) i,e.
MxKineticScrollView->MxViewPort->MyContainer(which has all allocate and dispose functions)

Actort1(MxBin)->Actor3(container) i,e.
MxKineticScrollView->MyContainer.

#0 0xb7fdd424 in __kernel_vsyscall ()
#1 0xb63c71ef in raise () from /lib/i386-linux-gnu/libc.so.6
#2 0xb63ca835 in abort () from /lib/i386-linux-gnu/libc.so.6
#3 0xb65e5b5e in g_assertion_message () from /lib/i386-linux-gnu/libglib-2.0.so.0
#4 0xb65e615f in g_assertion_message_expr () from /lib/i386-linux-gnu/libglib-2.0.so.0
#5 0xb6f16859 in clutter_actor_dispose (object=0x8356630) at ./clutter-actor.c:5057
#6 0xb6f9ec43 in clutter_group_dispose (object=0x8356630) at ./deprecated/clutter-group.c:390
#7 0xb67e85c7 in g_object_run_dispose () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#8 0xb6f0a8cd in clutter_actor_destroy (self=0x8356630) at ./clutter-actor.c:7157
#9 0xb6f1dc93 in clutter_actor_iter_destroy (iter=0xbfffddac) at ./clutter-actor.c:16948
#10 0xb6f1de48 in clutter_actor_real_destroy (actor=0x83541a8) at ./clutter-actor.c:5329
#11 0xb67e41ec in g_cclosure_marshal_VOID__VOID () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#12 0xb67e12fd in ?? () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#13 0xb67e2484 in g_closure_invoke () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#14 0xb67f3fa3 in ?? () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#15 0xb67fc2dc in g_signal_emit_valist () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#16 0xb67fc453 in g_signal_emit () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#17 0xb6f167fd in clutter_actor_dispose (object=0x83541a8) at ./clutter-actor.c:5031
#18 0xb6568da9 in dispose (object=0x83541a8) at roller.c:846
#19 0xb6563b9f in dispose (object=0x83541a8) at fixed-roller.c:141
#20 0xb67e85c7 in g_object_run_dispose () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#21 0xb6f0a8cd in clutter_actor_destroy (self=0x83541a8) at ./clutter-actor.c:7157
#22 0xb703ad0f in mx_bin_dispose (gobject=0x836a0a8) at ../mx/mx-bin.c:355
#23 0xb7084259 in mx_viewport_dispose (gobject=0x836a0a8) at ../mx/mx-viewport.c:221
#24 0xb67e71a2 in g_object_unref () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#25 0xb703b2a9 in mx_bin_set_child (bin=0x8366098, child=0x83541a8) at ../mx/mx-bin.c:56

@djdeath
Copy link
Contributor

djdeath commented Oct 18, 2012

One thing you need to keep in mind is that MyContainer needs to implement the MxScrollable interface, otherwise it won't be able to fit in the MxKineticScrollView.

Also, could you give us the version of Clutter and Mx you're using?
Mx 1.4 is incompatible with Clutter >= 1.10

@thos
Copy link
Member

thos commented Oct 18, 2012

Unfortunately you cannot use the generic clutter_actor_add_child and clutter_actor_remove_child to add or remove the child used in MxBin. This is because MxBin cannot determine whether the actor added or removed by this API should be managed by the subclass implementation (such as scrollbars in a scroll view), or whether it is the actor that should be managed by MxBin. You must always use mx_bin_set_child to add or remove the child that should be managed by MxBin.

If you replace clutter_actor_remove_child with mx_bin_set_child (bin, NULL), it should work as expected. Remember you must also unref the child after you have reparented it, to remove the temporary reference you added with g_object_ref.

@mmdemo
Copy link
Author

mmdemo commented Oct 18, 2012

MyContainer has implemented the MxScrollable interface,
Mx-1.4.6
Clutter-1.10.6/4

@mmdemo
Copy link
Author

mmdemo commented Oct 18, 2012

i am able to do the same. But Now I am getting Error Messages,
(test_app:4076): Mx-CRITICAL **: mx_viewport_set_origin: assertion `MX_IS_VIEWPORT (viewport)' failed
whenever adjustment gets changed.

Here Once viewPort is destroyed all the connected signals also should be disconnected. but here why is'nt it get disconnected?

it is calling mx_viewport_set_origin when my container sets the mxAdjustment value.!

@thos
Copy link
Member

thos commented Oct 18, 2012

This sounds like an bug with the scroll view.

@mmdemo
Copy link
Author

mmdemo commented Oct 19, 2012

Yes.

@mmdemo
Copy link
Author

mmdemo commented Oct 22, 2012

can this bug can be fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants