From owner-freebsd-current@FreeBSD.ORG Sat Dec 8 07:40:17 2012 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 68C8B979; Sat, 8 Dec 2012 07:40:17 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from ns.kevlo.org (kevlo.org [220.128.136.52]) by mx1.freebsd.org (Postfix) with ESMTP id F2A6D8FC14; Sat, 8 Dec 2012 07:40:16 +0000 (UTC) Received: from [127.0.0.1] (git.kevlo.org [220.128.136.52]) by ns.kevlo.org (8.14.5/8.14.5) with ESMTP id qB87eCp4014744; Sat, 8 Dec 2012 15:40:12 +0800 (CST) (envelope-from kevlo@FreeBSD.org) Message-ID: <1354952413.2318.4.camel@nsl> Subject: Re: problems with threads/destructors in -current with llvm/clang From: Kevin Lo To: Dimitry Andric Date: Sat, 08 Dec 2012 15:40:13 +0800 In-Reply-To: <50C1F862.2010501@FreeBSD.org> References: <50C1E81A.1040107@FreeBSD.org> <50C1F862.2010501@FreeBSD.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Cc: kde-freebsd@kde.org, freebsd-current@FreeBSD.org, Mark Atkinson X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Dec 2012 07:40:17 -0000 Dimitry Andric wrote: > On 2012-12-07 13:59, Dimitry Andric wrote: > > On 2012-12-06 18:12, Mark Atkinson wrote: > >> Short backstory, I had recently upgraded my workstation to the latest > >> current which included clang as default cc now. > > ... > >> qdbus under kde segfaults in malloc with a huge recursion stack: > ... > > This is a bug in qdbus; it uses a global static QDBusConnection object, > > and the order in which global destructors are called is undefined: > ... > > The global static QDBusConnection object should be replaced by a > > singleton, as suggested here: > > Here is an alternative solution, where the QDBusConnection object is > just a local variable in main(), and passed around as a const reference. > To make the destructors work properly, I also replaced the exit() calls > in main() with return statements. > > With this patch (placed in /usr/ports/devel/dbus-qt4/files), qdbus > starts up and exits normally for me. I did not do any other rigorous > testing, though. :) Works for me, thanks. I think your patch should go in. Kevin