[Gambas-user] [CRASH REPORT] gbUDisk2

Adrien Prokopowicz adrien.prokopowicz at ...626...
Mon Aug 7 15:02:09 CEST 2017


Le Sun, 06 Aug 2017 17:56:27 +0200, Tony Morehen  
<tmorehen at ...3602...> a écrit:

> Hello all,
>
> Damn, my program crashed Gambas this way :
>
> 1) Run the program
> 2) Plug in a usb drive
> 3) Click the mount button, mounts OK
> 4) Click the unmount button
> Program crashes Aborted(6)
> Console shows realloc error invalid old size
>
> Background:
> I'm writing a Udisks2 module that communicates with UDisks2 over dbus.
> It gathers drive info on existing drives and receives notifications when
> a new drive is plugged in, usb stick etc.
> Two problems:
> 1) The crash above.  Note that unmount works if the usb drive is already
> plugged in.  Careful: the program defaults to unmounting /dev/sdb1.
> Make sure you use the right drive id.
> 2) The program intially sends some basic drive info to debug output.
> First, it prints the info item by item with no problems. Then it tries
> to print the same items in one print statement.  Some of the output is
> garbage.  What's worst, I've tried saving each info item to separate
> variables.  If I step through the assignments one item at a time, the
> individual assignment is at first correct. However, after the next item
> is assigned, the previous item's value also changes.  This looks like a
> buffer overrun or a stack overflow.

After a bit of searching, I found that the offending code can be reduced to
this single line :

Print  
DBus["system://org.freedesktop.UDisks2"]["/org/freedesktop/UDisks2/block_devices/sda1",  
"org.freedesktop.UDisks2.Filesystem"].MountPoints

It appears this property gets translated to a Byte[][], but the  
interpreter crashes
when trying to create one from the native components, because the class's  
symbol table
is not initialized yet (as object classes are created dynamically).

However, creating one from Gambas code works, and in fact, creating one  
before
the D-Bus call makes it not crash anymore :

   Dim x As New Byte[][]
   Print  
DBus["system://org.freedesktop.UDisks2"]["/org/freedesktop/UDisks2/block_devices/sda1",  
"org.freedesktop.UDisks2.Filesystem"].MountPoints 'works!

Now you have a workaround, for until this is actually fixed. :)

Regards,
-- 
Adrien Prokopowicz




More information about the User mailing list