From patchwork Tue Dec 5 17:16:42 2006 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Udo Richter X-Patchwork-Id: 12417 Received: from mail.gmx.net ([213.165.64.20]) by www.linuxtv.org with smtp (Exim 4.50) id 1GrdwD-00036v-M7 for vdr@linuxtv.org; Tue, 05 Dec 2006 18:18:37 +0100 Received: (qmail invoked by alias); 05 Dec 2006 17:18:07 -0000 Received: from p57A8A78B.dip0.t-ipconnect.de (EHLO localhost) [87.168.167.139] by mail.gmx.net (mp020) with SMTP; 05 Dec 2006 18:18:07 +0100 X-Authenticated: #1417946 Message-ID: <4575A97A.2010102@gmx.de> Date: Tue, 05 Dec 2006 18:16:42 +0100 From: Udo Richter User-Agent: Thunderbird 2.0b1 (Windows/20061204) MIME-Version: 1.0 To: VDR Mailing List Subject: Re: [vdr] Segfault if cSkinDisplayMessage is replaced by another display object References: <456E3C35.5080708@gmx.de> In-Reply-To: <456E3C35.5080708@gmx.de> X-Y-GMX-Trusted: 0 X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Dec 2006 17:18:37 -0000 Status: O X-Status: X-Keywords: X-UID: 11362 Udo Richter wrote: > The attached patch changes cSkins::Message() by only checking the > existence of cSkinDisplay::Current(). If no current cSkinDisplay exists, > any old displayMessage object is deleted and a new one is created. I've found another segfault related to displayMessage. If VDR gets terminated while a message is displayed, the delete displayMessage in cSkins::~cSkins() takes action. But since Skins is a global variable, ~cSkins() will be called very late within the shutdown process, at a time when skins and OSD are already free'd. In case of skin plugins, the plugin program code is even already unloaded at that point, causing a segfault. The attached patch cleans up any remaining displayMessage before the cSkin objects are freed. Cheers, Udo --- skins.h.orig 2006-12-05 17:35:51.724023920 +0100 +++ skins.h 2006-12-05 17:37:27.589486448 +0100 @@ -360,6 +360,8 @@ ///< Processes the first queued message, if any. void Flush(void); ///< Flushes the currently active cSkinDisplay, if any. + virtual void Clear(void); + ///< Free up all registered skins }; extern cSkins Skins; --- skins.c.orig 2006-12-05 17:47:10.949575792 +0100 +++ skins.c 2006-12-05 18:05:27.597505048 +0100 @@ -358,3 +358,12 @@ if (cSkinDisplay::Current()) cSkinDisplay::Current()->Flush(); } + +void cSkins::Clear(void) +{ + if (displayMessage) { + delete displayMessage; + displayMessage = NULL; + } + cList::Clear(); +}