From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 551187EE3F for ; Fri, 25 Mar 2016 12:28:49 +0100 (CET) IronPort-PHdr: 9a23:H/V2mRLtTw/8IndjgNmcpTZWNBhigK39O0sv0rFitYgULv7xwZ3uMQTl6Ol3ixeRBMOAu6IC0bKd6fyocFdDyKjCmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TWM5DIfUi/yKRBybrysXNWC34Ltj6vop9X6WEZhunmUWftKNhK4rAHc5IE9oLBJDeIP8CbPuWZCYO9MxGlldhq5lhf44dqsrtY4q3wD86Fpy8kVWqz/e+E8TKdEJDUgKWE8osPx5jfZSg7ayXwHTWQQ2gRPBUDv9hz2U431tTSy4uV6wzabO4joCLocRjmoqatmHky7wBwbPiI0pTmEwvd7i7hW9Uqs Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=goswin-v-b@web.de; spf=Pass smtp.mailfrom=goswin-v-b@web.de; spf=None smtp.helo=postmaster@mout.web.de Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of goswin-v-b@web.de) identity=pra; client-ip=212.227.17.11; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="goswin-v-b@web.de"; x-sender="goswin-v-b@web.de"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of goswin-v-b@web.de designates 212.227.17.11 as permitted sender) identity=mailfrom; client-ip=212.227.17.11; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="goswin-v-b@web.de"; x-sender="goswin-v-b@web.de"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mout.web.de) identity=helo; client-ip=212.227.17.11; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="goswin-v-b@web.de"; x-sender="postmaster@mout.web.de"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0COAACXIPVWkwsR49RehAd9qECKLYduAQ2BcB2EYIEQAoE0OBQBAQEBAQEBARABAQEBBw0JCSEvgi2CFQEBBDIBVgsYCR4HDwUoCiqIEQEDEgS7Yx8rIoRiAQEBAQYBAQEBAQEBFQSKYoJbgi2CX4IrBZdghXGICYkzCoVYjwoeAQGCVoFSa4kdAQEB X-IPAS-Result: A0COAACXIPVWkwsR49RehAd9qECKLYduAQ2BcB2EYIEQAoE0OBQBAQEBAQEBARABAQEBBw0JCSEvgi2CFQEBBDIBVgsYCR4HDwUoCiqIEQEDEgS7Yx8rIoRiAQEBAQYBAQEBAQEBFQSKYoJbgi2CX4IrBZdghXGICYkzCoVYjwoeAQGCVoFSa4kdAQEB X-IronPort-AV: E=Sophos;i="5.24,390,1454972400"; d="scan'208";a="170800267" Received: from mout.web.de ([212.227.17.11]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Mar 2016 12:28:41 +0100 Received: from frosties.localnet ([134.3.242.84]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0Lz3FM-1Zfbqa2Fyy-014EkP for ; Fri, 25 Mar 2016 12:28:40 +0100 Received: from mrvn by frosties.localnet with local (Exim 4.84) (envelope-from ) id 1ajPux-00074M-Pp for caml-list@inria.fr; Fri, 25 Mar 2016 12:28:39 +0100 Date: Fri, 25 Mar 2016 12:28:39 +0100 From: Goswin von Brederlow To: caml-list@inria.fr Message-ID: <20160325112839.GA27075@frosties> References: <20160323105016.GA2235@frosties> <56F2CFD4.4000401@cea.fr> <20160324102559.GB32689@frosties> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20160324102559.GB32689@frosties> User-Agent: Mutt/1.5.23 (2014-03-12) X-Provags-ID: V03:K0:bFWNVMJ7Kdp548V3LZX+q0M4Hi7pQKkeCNBD6skFXRDXcjT3HVd +gcK3UDHuLZympzTK6/sWF0fhVOQoEmnM+Wy9CYL1/yLkzAfitxqoFYtUqL/nuVaJQF/U8t sX7QPVnv9s3lQMTzVHnj7Iuj+52jYAB4NMeHV1IKjz/0WKOX25dsYLCBXlRKnSKJMsnrtAh lKQ0swSq6mu1kUygB20HA== X-UI-Out-Filterresults: notjunk:1;V01:K0:Kr75lRguKm4=:wUGP9ZruW48qjt4tZs2eeA 1Pc54+x5+7PFTt5wrddqrVD0ArhtlowBtRRx6iByDdD3/8LLHf2iJXRlHzHdzxXQxK0qjCsP4 ecWu3k3/5t8okcM3/GSHBZbTRo4SZkawHJOfLVu0UBsaVy9ZG4KwOlOZjs6DLubM5cs9Dx03J Rmdzrk0d8sw9quRzZK5HUDtzTPfglT3NiFwJ5YLXZQnXc7XDiQ9BECzmL6aM/e57gtB1c5YGB BT7IfUVnjWucM0yva3FWKG2BOGq6V37H6DCzb0xqaQvTc5FD5wm4iohLqffqMg9fsAwKq96BT mY0g/NDz2m+waPox255xBdRrHkSF3rgz6w2aky1ACml2cnvqMQO64zZ7jKNE9gLqmBBSu4iiA KjMXzAVCTop4Hd1epszv2hB1jsllQTL1CpvROqrecNGgCzlaUcnBWHFHketvvfsrLLwnidjJc /72nrJvg61PTfTild4B5KVQ83XDw5EuiMDAcOVujcoBZWV1Sk3URmwpvSWjd66fyBJHKYfmpZ Cmjfyps1ylcPif+G5ETW9jjSahcDt2lCKy1att4yFk8sG2eGIKJq2RXV3b0ZSr7/tWtNVQeX7 +gqd5DC2lGMayRaWFVeSFy2simYG5VM2F1i4U6Yk869PJvhtcAHo89UyeKQj+bSNO2znpWah0 25ILDqkjlqobYPh7lE0zMI14YS/TbGH182O780T2C9csuJIqG0XSqhLQudSudDrxtoAERv0HC pqpo2/XERvqiz/Q+ET+kkqqmVhiPUD4eiPawmE6QwUOe8vdvKhrxl5v/CAY= Subject: Re: [Caml-list] RFH: can't figure out why my QT5 widget bindings segfault On Thu, Mar 24, 2016 at 11:25:59AM +0100, Goswin von Brederlow wrote: > On Wed, Mar 23, 2016 at 06:18:12PM +0100, François Bobot wrote: > > On 23/03/2016 16:18, Anatoly Zaretsky wrote: > > >On Wed, Mar 23, 2016 at 12:50 PM, Goswin von Brederlow > >> wrote: > > > > > > I'm stuck with a bug in the Tetrix example for my QT5 bindings: > > > > > > https://github.com/mrvn/ocaml-qt5 > > > > > > The segfault happens when you click start and the first piece is moved > > > one tile down in caml_mrvn_QT5_OPainter_fillRect. The arguments to the > > > call all look ok but something must corrupt the painter. The segfault > > > goes away when I force a Gc.full_major before creating a new OPainter > > > in TetrixBoard:148. Turns out the problem has nothing directly to do with the ocaml bindings. The problem is that Qt only allows one active painter per paint device at a time and has explicit begin()/end() functions to start and top painting where begin() does error checking. The QPainter constructor also allows passing the paint device directly, which automatically calls begin(device) but reports no errors. The destructor then also automatically calls end(). Problem in ocaml now is that the destructor no longer runs when the painter goes out of scope but only when the Gc gets around to it. And for some reason creating a second painter for a device kind of works (in disregard of what the API says) as long as you don't destroy the first one half way through, which the Gc does. I've converted to explicit painter#begin_ and painter#end_ calls and added some checks in the bindings to enforce them and now everything works. Now off to adding KeyEvent parsing and one can actually play. MfG Goswin