Received: from eggs.gnu.org ([2001:4830:134:3::10]:51492) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZsXg-00074s-Ts for qemu-devel@nongnu.org; Wed, 09 Sep 2015 23:28:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZsXd-0000Lh-Mm for qemu-devel@nongnu.org; Wed, 09 Sep 2015 23:28:56 -0400 Received: from mail-qg0-x234.google.com ([2607:f8b0:400d:c04::234]:33690) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZsXd-0000Lb-98 for qemu-devel@nongnu.org; Wed, 09 Sep 2015 23:28:53 -0400 Received: by qgev79 with SMTP id v79so25621097qge.0 for ; Wed, 09 Sep 2015 20:28:53 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: multipart/alternative; boundary=Apple-Mail-4--307938143 From: Programmingkid In-Reply-To: <8737yocap6.fsf@blackfin.pond.sub.org> Date: Wed, 9 Sep 2015 23:28:49 -0400 Message-Id: References: <65D87A2B-B94F-4236-A9BB-D0F0B7FCF96B@gmail.com> <26B5A68C-92C9-4528-BA17-4A282DCFF035@gmail.com> <87fv2og36d.fsf@blackfin.pond.sub.org> <9F6A7240-9CB8-41E2-AB87-B74CD7961191@gmail.com> <8737yocap6.fsf@blackfin.pond.sub.org> Subject: Re: [Qemu-devel] [PATCH] ui/cocoa.m: Add Mount image file menu item List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Peter Maydell , qemu-devel qemu-devel --Apple-Mail-4--307938143 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Does this look about right? QDict *qdict; Error *errp; QObject **ret_data; static int counter; char *idString, *fileName; // The file variable is objective-c, left that code out fileName =3D g_strdup_printf("%s", [file cStringUsingEncoding: = NSASCIIStringEncoding]); =20 /* Create an unique id */ idString =3D g_strdup_printf("USB%d", counter++); /* Create the QDICT object */ qdict =3D qdict_new(); qdict_put_obj(qdict, "id", qstring_from_str(idString)); qdict_put_obj(qdict, "device", qstring_from_str(idString)); qdict_put_obj(qdict, "if", qstring_from_str("none")); qdict_put_obj(qdict, "file", qstring_from_str(fileName)); qdict_put_obj(qdict, "driver", qstring_from_str("usb-storage")); drive_add(IF_DEFAULT, 0, fileName, "none"); qmp_device_add(qdict, ret_data, &errp); handleAnyDeviceErrors(errp); g_free(fileName); g_free(idString); This is a sample of what I am working on. For some reason, it crashes = QEMU. Any clues why? I think it might be because of qdict_put_obj().=20= --Apple-Mail-4--307938143 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii
Does this look about right?
    QDict *qdict;
  =   Error *errp;
    QObject **ret_data;
  =   static int counter;
    char *idString, *fileName;

// The = file variable is objective-c, left that code out
        fileName =3D = g_strdup_printf("%s",
  =                     =       [file cStringUsingEncoding: = NSASCIIStringEncoding]);

     =    

      =   /* Create an unique id */
        = idString =3D g_strdup_printf("USB%d", counter++);

      =   /* Create the QDICT object */
        = qdict =3D qdict_new();
        qdict_put_obj(qdict, = "id", = qstring_from_str(idString));
        = qdict_put_obj(qdict, "device", = qstring_from_str(idString));
        = qdict_put_obj(qdict, "if", = qstring_from_str("none"));
        = qdict_put_obj(qdict, "file", = qstring_from_str(fileName));
        = qdict_put_obj(qdict, "driver", = qstring_from_str("usb-storage"));
        = drive_add(IF_DEFAULT, 0, fileName, = "none");
  =       qmp_device_add(qdict, ret_data, = &errp);
        = handleAnyDeviceErrors(errp);
        = g_free(fileName);
        = g_free(idString);

This is a sample of what I am working = on. For some reason, it crashes QEMU. Any clues why? I think it might be = because of qdict_put_obj(). 
= --Apple-Mail-4--307938143--