Curiouser and curiouser...

I came across a patch that has something to do with the subject. This patch was introduced almost a year ago into qt3-3.0.5-6 and was removed (forgotten?) in the update to qt-3.1. Here it is (from qt3-3.0.5-6.patch):

--- qt-x11-free-3.0.5/src/tools/qstring.cpp     Wed Sep 11 21:42:23 2002
+++ qt-x11-free-3.0.5-new/src/tools/qstring.cpp Wed Sep 11 21:42:26 2002
@@ -12528,7 +12528,7 @@
 QStringData* QString::makeSharedNull()
 {
     QString::shared_null = new QStringData;
-#if defined( Q_OS_MAC )
+#if 1 /* defined( Q_OS_MAC ) */
     QString *that = const_cast<QString *>(&QString::null);
     that->d = QString::shared_null;
 #endif

I am not sure if I want to learn enough C++ to understand what this is doing. But I recompiled qt3 with this patch applied, and it helps, sort of.

It does not eliminate crash No 1 ("QString crash1 = QString::null"), but it eliminates crashes No 2 (QDir) and 3 (QFile::open). And it even eliminates crash No 1, if anything else is done beforehand which invokes QString. For example, if crashtest No 2 is put before crashtest No 1, both don't crash.

In particular, with this patched version of qt3, scribus-1.0-1 does not segfault any more, even when LANG is set. (In the meantime, I have made a package with a workaround, version 1.0.1-1).

Max Horn wrote:

Am Freitag, 08.08.03 um 17:35 Uhr schrieb Martin Costabel:

[...]

I am not buying this explanation completely, because on Darwin, this bus error happens *every time*, and on Linux, *never*. So it doesn't look like a problem involving randomly filled memory locations.


Oh it's not a surprise. While the order in which static constructors are executed is not defined by the C++ standard, and may be completely random, on most target systems the order in which they are called is (semi-)deterministic. The reason why it never works on OS X and always on Linux could be something as trivial as that the one follow the rules "execute them alphabetically" and the other "execute them in reverse alphabetical order". Well the real rules will be different, involve the place where the constructors are defined etc., but you get the idea.

I'll believe anything you say about C++ (given that I know nothing about it), but it really looks like QString:null *is* initialized, just not correctly. With the above patch, it is initialized correctly, at least sometimes. Or does this only change the time when it is initialized?


--
Martin




------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ Fink-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/fink-devel

Reply via email to