From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51939) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZwAQ-0001zo-Jc for qemu-devel@nongnu.org; Thu, 10 Sep 2015 03:21:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZwAL-0003z5-Lu for qemu-devel@nongnu.org; Thu, 10 Sep 2015 03:21:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57706) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZwAL-0003yo-Gm for qemu-devel@nongnu.org; Thu, 10 Sep 2015 03:21:05 -0400 From: Markus Armbruster 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> Date: Thu, 10 Sep 2015 09:21:03 +0200 In-Reply-To: (Programmingkid's message of "Wed, 9 Sep 2015 23:28:49 -0400") Message-ID: <8737ym210g.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain 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: Programmingkid Cc: Peter Maydell , qemu-devel qemu-devel Programmingkid writes: > 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 = g_strdup_printf("%s", > [file cStringUsingEncoding: NSASCIIStringEncoding]); > > /* Create an unique id */ > idString = g_strdup_printf("USB%d", counter++); > > /* Create the QDICT object */ > qdict = 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(). My crystal ball is down for maintenance today, so you'll have to gives us the clues yourself: a stack backtrace, for starters :)