Gtk::Main::iteration(false) crash



Hi!
I'm trying to debug a crash that happen on Mac OSX only. I'm using OSX Lion on iMac intel i5.

During a looping task (Canvasview::play()) there is a while loop that calls the Gtk::Main::iteration(false) method:

// wait for the workarea to refresh itself
while (studio::App::events_pending())
   studio::App::iteration(false);


The crash happens when I repeatedly press the play button that triggers the play function.

This is the relevant section of code:

CanvasView::on_play_pause_pressed() is called on each pause_button click and when the button is repeatedly clicked there is a crash.


//! Modify the play stop button appearance and play stop the animation
void
CanvasView::on_play_pause_pressed()
{
if(!is_playing()) // is_playing() returns is_playing_
{
toggle_play_pause_button();
play();
}
else
{
toggle_play_pause_button();
stop();
}
}


void
CanvasView::toggle_play_pause_button()
{
Gtk::IconSize iconsize=Gtk::IconSize::from_name("synfig-small_icon_16x16");
Gtk::Image *icon;
Gtk::Button *pause_button;
pause_button=framedial->get_play_button();
if(!is_playing())
{
icon = manage(new Gtk::Image(Gtk::StockID("synfig-animate_pause"),iconsize));
pause_button->remove();
pause_button->add(*icon);
icon->set_padding(0, 0);
icon->show();
pause_button->set_relief(Gtk::RELIEF_NORMAL);
}
else
{
icon = manage(new Gtk::Image(Gtk::StockID("synfig-animate_play"),iconsize));
pause_button->remove();
pause_button->add(*icon);
icon->set_padding(0, 0);
icon->show();
pause_button->set_relief(Gtk::RELIEF_NONE);
}
}

void
CanvasView::play()
{
assert(get_canvas());
// If we are already busy, don't play!

if(working_depth)return;
// Set us up as working

IsWorking is_working(*this);
etl::clock timer;

Timetime=work_area->get_time(), endtime=get_canvas()->rend_desc().get_time_end();
// If we are already at the end of time, start over

if(time==endtime)
time=get_canvas()->rend_desc().get_time_start();
is_playing_=true;

work_area->clear_ducks();

for(timer.reset(); time + timer() < endtime;)

{
//Clamp the time window so we can see the time value as it races across the horizon
bool timewindreset = false;
while( time + timer() > Time(time_window_adjustment().get_sub_upper()) )

{
time_window_adjustment().set_value(
min(
time_window_adjustment().get_value()+time_window_adjustment().get_page_size()/2,
time_window_adjustment().get_upper()-time_window_adjustment().get_page_size() )
);
timewindreset = true;
}

while( time + timer() < Time(time_window_adjustment().get_sub_lower()) )
{
time_window_adjustment().set_value(
max(
time_window_adjustment().get_value()-time_window_adjustment().get_page_size()/2,
time_window_adjustment().get_lower())
);

timewindreset = true;
}

//we need to tell people that the value changed
if(timewindreset) time_window_adjustment().value_changed();

//update actual time to next step
time_adjustment().set_value(time+timer());
time_adjustment().value_changed();

if(!work_area->sync_render_preview())
break;

// wait for the workarea to refresh itself
while (studio::App::events_pending())
studio::App::iteration(false); /// <<<<<  CRASH HAPPENS HERE (line 3259 on debugger message)

if(get_cancel_status())
{
is_playing_=false;
return;
}
}
is_playing_=false;
time_adjustment().set_value(endtime);
time_adjustment().value_changed();
}



After crash a debug session shows this:
Program received signal SIGTRAP, Trace/breakpoint trap.
0x00000001035310d4 in g_logv ()
(gdb) where
#0  0x00000001035310d4 in g_logv ()
#1  0x0000000103531204 in g_log ()
#2  0x0000000102c98d76 in Glib::exception_handlers_invoke ()
#3  0x000000010230bf16 in (anonymous namespace)::Widget_signal_expose_event_callback ()
#4  0x00000001028d67af in _gtk_marshal_BOOLEAN__BOXED ()
#5  0x000000010349bb62 in g_closure_invoke ()
#6  0x00000001034aba49 in signal_emit_unlocked_R ()
#7  0x00000001034ac471 in g_signal_emit_valist ()
#8  0x00000001034ac9b4 in g_signal_emit ()
#9  0x00000001029f365c in gtk_widget_event_internal ()
#10 0x00000001028d43f1 in gtk_main_do_event ()
#11 0x0000000102d507ed in _gdk_window_process_updates_recurse ()
#12 0x0000000102d50734 in _gdk_window_process_updates_recurse ()
#13 0x0000000102d511b1 in gdk_window_process_updates_internal ()
#14 0x0000000102d50d07 in gdk_window_process_all_updates ()
#15 0x0000000102851f30 in gtk_container_idle_sizer ()
#16 0x0000000102d2f775 in gdk_threads_dispatch ()
#17 0x0000000103526f64 in g_main_context_dispatch ()
#18 0x00000001035293f7 in g_main_context_iterate ()
#19 0x00000001035294d2 in g_main_context_iteration ()
#20 0x00000001028d3fc2 in gtk_main_iteration_do ()
#21 0x000000010229274d in Gtk::Main::iteration_impl ()
#22 0x00000001022926b6 in Gtk::Main::iteration ()
#23 0x000000010058c112 in studio::CanvasView::play (this=0x104537400) at canvasview.cpp:3259
#24 0x000000010058c3fb in studio::CanvasView::on_play_pause_pressed (this=0x104537400) at canvasview.cpp:4111
#25 0x00000001005d7408 in sigc::bound_mem_functor0<void, studio::CanvasView>::operator() (this=0x105567038) at mem_fun.h:1787
#26 0x00000001005d7433 in sigc::adaptor_functor<sigc::bound_mem_functor0<void, studio::CanvasView> >::operator() (this=0x105567030) at adaptor_trait.h:251
#27 0x00000001005d138d in sigc::internal::slot_call0<sigc::bound_mem_functor0<void, studio::CanvasView>, void>::call_it (rep=0x105567000) at slot.h:103
#28 0x0000000102c9eadf in Glib::SignalProxyNormal::slot0_void_callback ()
#29 0x000000010349bb62 in g_closure_invoke ()
#30 0x00000001034aba49 in signal_emit_unlocked_R ()
#31 0x00000001034ac37b in g_signal_emit_valist ()
#32 0x00000001034ac9b4 in g_signal_emit ()
#33 0x000000010282a2f8 in gtk_real_button_released ()
#34 0x000000010349bb62 in g_closure_invoke ()
#35 0x00000001034ab359 in signal_emit_unlocked_R ()
#36 0x00000001034ac37b in g_signal_emit_valist ()
#37 0x00000001034ac9b4 in g_signal_emit ()
#38 0x0000000102829de3 in gtk_button_button_release ()
#39 0x00000001028d67af in _gtk_marshal_BOOLEAN__BOXED ()
#40 0x000000010349bb62 in g_closure_invoke ()
#41 0x00000001034ab874 in signal_emit_unlocked_R ()
#42 0x00000001034ac471 in g_signal_emit_valist ()
#43 0x00000001034ac9b4 in g_signal_emit ()
#44 0x00000001029f365c in gtk_widget_event_internal ()
#45 0x00000001028d489f in gtk_propagate_event ()


Do you have any clue on what can be causing the crash? Maybe the icon addition and deletion causes the crash? I'm a bit lost on this bug and don't know what else can I do to fix it.
Thanks for take your time.
Cheers
Carlos


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