From owner-freebsd-current@FreeBSD.ORG Fri Dec 7 16:43:57 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 18C8B60E for ; Fri, 7 Dec 2012 16:43:57 +0000 (UTC) (envelope-from freebsd-current@m.gmane.org) Received: from plane.gmane.org (plane.gmane.org [80.91.229.3]) by mx1.freebsd.org (Postfix) with ESMTP id B67F68FC18 for ; Fri, 7 Dec 2012 16:43:56 +0000 (UTC) Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Th11x-0008Dn-Sv for freebsd-current@freebsd.org; Fri, 07 Dec 2012 17:44:05 +0100 Received: from 50-46-163-238.evrt.wa.frontiernet.net ([50.46.163.238]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 07 Dec 2012 17:44:05 +0100 Received: from atkin901 by 50-46-163-238.evrt.wa.frontiernet.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 07 Dec 2012 17:44:05 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-current@freebsd.org From: Mark Atkinson Subject: Re: problems with threads/destructors in -current with llvm/clang Date: Fri, 07 Dec 2012 08:43:48 -0800 Lines: 32 Message-ID: References: <50C1E81A.1040107@FreeBSD.org> <50C1F862.2010501@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 50-46-163-238.evrt.wa.frontiernet.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Thunderbird/17.0 In-Reply-To: <50C1F862.2010501@FreeBSD.org> Cc: kde-freebsd@freebsd.kde.org 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: Fri, 07 Dec 2012 16:43:57 -0000 On 12/7/2012 6:08 AM, 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. :) Thanks for the awesome analysis. I will endeavor to figure out the bug in automoc4 that keeps it segfaulting randomly during compilation. Weirdly it segfaults reliably under portmaster, but may work just fine under just make.