[Libburn] Crash using libburn+libisofs

Bryan Forbes bryan at reigndropsfall.net
Mon Aug 9 14:32:41 PDT 2004


I'm having an awfull time trying to get Coaster to burn from a data
layout to a CD.  I can get the data layout parsed down to an ISO
volumeset (by the way, is a volumeset basically a session?) and it
prints out correctly, but it crashes when it starts burning.  Here is
what I'm doing (remember, this is c++, but it shouldn't be much
different than the C, except with namespaces... also, the sigc::slot is
just a callback to update the progressbars in my dialog):

bool burndisc(burn::burn_drive_info* drive_info,
              int speed,
              BurnType burn_type,
              const sigc::slot<void,double,double>& slot_progress,
              std::deque<ViewLayout*>& layout_array,
              const LayoutProperties& lp)
{
  burn::burn_disc* disc = burn::burn_disc_create();
  burn::burn_session* session = burn::burn_session_create();
  
  burn::burn_disc_add_session(disc, session, BURN_POS_END);

  burn::burn_track* tr = burn::burn_track_create();
  burn::burn_track_define_data(tr, 0, 0, 0, BURN_MODE1);

  // I'll show you what parse_layout_to_volset does below...
  iso::iso_volumeset* volset = parse_layout_to_volset(layout_array, lp);

  burn::burn_source* src = (burn::burn_source*)iso::iso_source_new
(volset, 0);

  if(burn::burn_track_set_source(tr, src) != burn::BURN_SOURCE_OK)
  {
    Util::debug("Burn: IO: burn source not OK");
    return false;
  }

  burn::burn_session_add_track(session, tr, BURN_POS_END);
  burn::burn_source_free(src);

  // I'll show you what prepare_drive does below...
  if(!prepare_drive(drive_info, burn::BURN_DISC_BLANK))
  {
    Util::debug("Burn: IO: disc not blank");
    return false;
  }

  burn::burn_write_opts* o = burn::burn_write_opts_new(drive_info-
>drive);
  burn::burn_write_opts_set_perform_opc(o, 0);
  burn::burn_write_opts_set_write_type(o, burn::BURN_WRITE_TAO,
burn::BURN_BLOCK_MODE1);
  burn::burn_write_opts_set_simulate(o, 1);
  burn::burn_drive_set_speed(drive_info->drive, 0, speed);

  burn::burn_disc_write(o, disc);
  burn::burn_write_opts_free(o);

  burn::burn_progress p;
  const Glib::RefPtr<Glib::MainContext> context =
Glib::MainContext::get_default();
  while (burn::burn_drive_get_status(drive_info->drive, &p))
  {
    Util::debug(String::ucompose("IO Burn: %1", p.sector));
    
    do {} while(context->iteration(false));
    slot_progress(p.track/p.tracks,p.sector/p.sectors);
    Glib::usleep(100000);
  }

  burn::burn_drive_release(drive_info->drive, 0);
  
  burn::burn_track_free(tr);
  burn::burn_session_free(session);
  burn::burn_disc_free(disc);
  iso::iso_volumeset_free(volset);
  
  return true;
}

here's parse_layout_to_volset():
(a deque is a double-ended queue... it's treated as a dynamic array)

iso::iso_volumeset* parse_layout_to_volset(
          std::deque<Coaster::ViewLayout*>& layout_array,
          const Coaster::LayoutProperties& lp)
{
  Coaster::ViewLayout* vl = layout_array[0];
  gchar* volume_names[] = { "CDROM" };
  
  iso::iso_volumeset* volset = iso::iso_volumeset_new(1, lp.title.c_str
(), volume_names, lp.publisher.c_str(), lp.publisher.c_str(), NULL,
NULL);
 
  iso::iso_volumeset_set_iso_level(volset, lp.isolevel);
  iso::iso_volumeset_set_rr(volset, lp.rockridge);
  iso::iso_volumeset_set_joliet(volset, lp.joliet);

  iso::iso_tree_dir **root = iso_volumeset_get_root(volset);

  // tree_to_iso() is a call to recursively go thru the layout and
  // add files and directories to the root... this works but I'm
  // not going to show this because it's a long function... I checked
  // the output with iso_tree_print() and it turns out fine.
  tree_to_iso(vl->get_tree(), root);
  iso::iso_tree_print(root);

  return volset;
}

here's prepare_drive():

bool prepare_drive(burn::burn_drive_info* drive_info,
                   burn::burn_disc_status status)
{
  using namespace burn;

  while(!burn_drive_grab(drive_info->drive, 0));

  while(burn_drive_get_status(drive_info->drive, NULL)) Glib::usleep
(100000);

  burn_disc_status s;
  while((s = burn_disc_get_status(drive_info->drive)) ==
BURN_DISC_UNREADY) Glib::usleep(100000);

  Coaster::Util::debug(String::ucompose("IO Status: %1", s));
  if(s != status)
  {
    burn_drive_release(drive_info->drive, 0);
    //Gtk::MessageDialog
    return false;
  }
  
  return true;
}

I'm not sure why it crashes.  I ran gdb on it and here is the backtrace
I get:

(gdb) thread apply all bt

Thread 8 (Thread 98311 (LWP 28721)):
#0  iso_source_generate (src=0x31, buffer=0x800 <Address 0x800 out of
bounds>, size=0)
    at libisofs/writer.c:375
#1  0x0e67a93c in iso_source_generate (src=0x31, buffer=0x800 <Address
0x800 out of bounds>, size=0)
    at libisofs/writer.c:370
#2  0x0e6e7718 in sector_data (o=0xe6952b0, t=0x800, psub=847391360) at
libburn/sector.c:431
#3  0x0e6eb12c in burn_write_track (o=0x32822a80, s=0x10343208,
tnum=510) at libburn/write.c:374
#4  0x0e6eafa0 in burn_write_session (o=0x0, s=0xe67a930) at
libburn/write.c:319
#5  0x0e6eb460 in burn_disc_write_sync (o=0x32822a80, disc=0x32822990)
at libburn/write.c:473
#6  0x0e6e2ca8 in write_disc_worker_func (w=0xe67a930) at
libburn/async.c:156
#7  0x30018e40 in pthread_start_thread () from /lib/libpthread.so.0
#8  0x30018eb8 in pthread_start_thread_event ()
from /lib/libpthread.so.0
#9  0x302c637c in clone () from /lib/libc.so.6

Thread 6 (Thread 65541 (LWP 28719)):
#0  0x3001b72c in __pthread_sigsuspend () from /lib/libpthread.so.0
#1  0x3001b464 in __pthread_wait_for_restart_signal ()
from /lib/libpthread.so.0
#2  0x30018034 in pthread_cond_wait at GLIBC_2.0 ()
from /lib/libpthread.so.0
#3  0x0e8836ac in _gnome_vfs_thread_pool_init ()
from /usr/lib/libgnomevfs-2.so.0
#4  0x0e883710 in _gnome_vfs_thread_pool_init ()
from /usr/lib/libgnomevfs-2.so.0
#5  0x0fa48440 in g_static_private_free ()
from /usr/lib/libglib-2.0.so.0
#6  0x30018e40 in pthread_start_thread () from /lib/libpthread.so.0
#7  0x30018eb8 in pthread_start_thread_event ()
from /lib/libpthread.so.0
#8  0x302c637c in clone () from /lib/libc.so.6

Thread 3 (Thread 16386 (LWP 28716)):
#0  0x302bc548 in poll () from /lib/libc.so.6
#1  0x0fa2d330 in g_main_loop_get_context ()
from /usr/lib/libglib-2.0.so.0
#2  0x0fa2c4f4 in g_main_context_dispatch ()
from /usr/lib/libglib-2.0.so.0
#3  0x0fa2cd90 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#4  0x0e7aa134 in link_thread_io_context ()
from /usr/lib/libORBit-2.so.0
#5  0x0fa48440 in g_static_private_free ()
from /usr/lib/libglib-2.0.so.0
#6  0x30018e40 in pthread_start_thread () from /lib/libpthread.so.0
#7  0x30018eb8 in pthread_start_thread_event ()
from /lib/libpthread.so.0
#8  0x302c637c in clone () from /lib/libc.so.6

Thread 2 (Thread 32769 (LWP 28715)):
#0  0x302bc548 in poll () from /lib/libc.so.6
#1  0x30018bd8 in __pthread_manager () from /lib/libpthread.so.0
#2  0x30018d68 in __pthread_manager_event () from /lib/libpthread.so.0
#3  0x302c637c in clone () from /lib/libc.so.6

Thread 1 (Thread 16384 (LWP 28712)):
#0  0x3001f888 in nanosleep () from /lib/libpthread.so.0
#1  0x3001f874 in nanosleep () from /lib/libpthread.so.0
#2  0x0fa4b3a0 in g_usleep () from /usr/lib/libglib-2.0.so.0
#3  0x0e8fa584 in Glib::usleep () from /usr/lib/libglibmm-2.4.so.1
#4  0x100360e4 in Coaster::IO::burndisc (drive_info=0x1015e290,
speed=2147474500,
    burn_type=COASTER_BURN_AUDIO, slot_progress=@0x7fffddf0,
layout_array=@0x7fffdbe0, lp=@0x10335d68)
    at cd-io.cc:205
#5  0x10056af4 in Coaster::ViewNotebook::on_burn_clicked
(this=0x101c5358) at slot.h:166
#6  0x10046848 in sigc::adaptor_functor<sigc::bound_mem_functor0<void,
Coaster::ViewNotebook> >::operator() (
    this=0x0) at mem_fun.h:1781
#7  0x100467fc in
sigc::internal::slot_call0<sigc::bound_mem_functor0<void,
Coaster::ViewNotebook>, void>::call_it (rep=0x204) at slot.h:89
#8  0x0e8f8090 in Glib::SignalProxyNormal::slot0_void_callback ()
from /usr/lib/libglibmm-2.4.so.1
#9  0x0f93405c in g_cclosure_marshal_VOID__VOID ()
from /usr/lib/libgobject-2.0.so.0
#10 0x0f91e5a4 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#11 0x0f933848 in g_signal_emit_by_name ()
from /usr/lib/libgobject-2.0.so.0
#12 0x0f9329ec in g_signal_emit_valist ()
from /usr/lib/libgobject-2.0.so.0
#13 0x0f932d38 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#14 0x0fb1885c in _gtk_action_emit_activate () from /usr/lib/libgtk-
x11-2.0.so.0
#15 0x0fb18940 in gtk_action_activate () from /usr/lib/libgtk-
x11-2.0.so.0
#16 0x0f93405c in g_cclosure_marshal_VOID__VOID ()
from /usr/lib/libgobject-2.0.so.0
#17 0x0f91e5a4 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#18 0x0f933ac4 in g_signal_emit_by_name ()
from /usr/lib/libgobject-2.0.so.0
#19 0x0f9329ec in g_signal_emit_valist ()
from /usr/lib/libgobject-2.0.so.0
#20 0x0f932e98 in g_signal_emit_by_name ()
from /usr/lib/libgobject-2.0.so.0
#21 0x0fc9a950 in gtk_tool_button_get_type () from /usr/lib/libgtk-
x11-2.0.so.0
#22 0x0f93405c in g_cclosure_marshal_VOID__VOID ()
from /usr/lib/libgobject-2.0.so.0
#23 0x0f91e5a4 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#24 0x0f933ac4 in g_signal_emit_by_name ()
from /usr/lib/libgobject-2.0.so.0
#25 0x0f9329ec in g_signal_emit_valist ()
from /usr/lib/libgobject-2.0.so.0
#26 0x0f932d38 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#27 0x0fb25628 in gtk_button_clicked () from /usr/lib/libgtk-
x11-2.0.so.0
#28 0x0fb26804 in _gtk_button_paint () from /usr/lib/libgtk-x11-2.0.so.0
#29 0x0f93405c in g_cclosure_marshal_VOID__VOID ()
from /usr/lib/libgobject-2.0.so.0
#30 0x0f91e930 in g_cclosure_new_swap ()
from /usr/lib/libgobject-2.0.so.0
#31 0x0f91e5a4 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#32 0x0f933374 in g_signal_emit_by_name ()
from /usr/lib/libgobject-2.0.so.0
#33 0x0f9329ec in g_signal_emit_valist ()
from /usr/lib/libgobject-2.0.so.0
#34 0x0f932d38 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#35 0x0fb25568 in gtk_button_released () from /usr/lib/libgtk-
x11-2.0.so.0
#36 0x0fb26618 in _gtk_button_paint () from /usr/lib/libgtk-x11-2.0.so.0
#37 0x0fbe62f0 in _gtk_marshal_BOOLEAN__BOXED () from /usr/lib/libgtk-
x11-2.0.so.0
#38 0x0f91e930 in g_cclosure_new_swap ()
from /usr/lib/libgobject-2.0.so.0
#39 0x0f91e5a4 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#40 0x0f933470 in g_signal_emit_by_name ()
from /usr/lib/libgobject-2.0.so.0
#41 0x0f9327b0 in g_signal_emit_valist ()
from /usr/lib/libgobject-2.0.so.0
#42 0x0f932d38 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#43 0x0fcebee8 in gtk_widget_send_expose () from /usr/lib/libgtk-
x11-2.0.so.0
#44 0x0fbe4670 in gtk_propagate_event () from /usr/lib/libgtk-
x11-2.0.so.0
#45 0x0fbe3118 in gtk_main_do_event () from /usr/lib/libgtk-x11-2.0.so.0
#46 0x0f9b965c in _gdk_events_queue () from /usr/lib/libgdk-x11-2.0.so.0
#47 0x0fa2ac70 in g_main_depth () from /usr/lib/libglib-2.0.so.0
#48 0x0fa2c1b4 in g_main_context_dispatch ()
from /usr/lib/libglib-2.0.so.0
#49 0x0fa2c584 in g_main_context_dispatch ()
from /usr/lib/libglib-2.0.so.0
#50 0x0fa2cd90 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#51 0x0fbe281c in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#52 0x0ed4bf8c in Gtk::Main::run_impl () from /usr/lib/libgtkmm-2.4.so.1
#53 0x0ed4bce8 in Gtk::Main::run () from /usr/lib/libgtkmm-2.4.so.1
#54 0x10047f9c in main (argc=262802436, argv=0x3033121c) at main.cc:261
375             assert(src->read == iso_source_generate &&

I hope this helps (I'm not sure if the glib/gtk+ backtraces will help),
because if I'm doing something wrong, I'm sure if I fix that, Coaster
will burn data CD's.  Thanks in advance!!

-- 
======================================================================
Bryan Forbes
bryan at reigndropsfall.net
http://www.reigndropsfall.net

"It does not take a majority to prevail, but rather an irate, tireless
minority keen to set brush fires in people's minds."
        - Samuel Adams, an architect of the Constitution

Key fingerprint = 3D7D B728 713A BB7B B8B1  5B61 3888 17E0 70CA 0F3D
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://freedesktop.org/pipermail/libburn/attachments/20040809/9eec68a3/attachment.pgp


More information about the libburn mailing list