By default, Bugzilla does not search the list of RESOLVED bugs.
You can force it to do so by putting the upper-case word ALL in front of your search query, e.g.: ALL tdelibs
We recommend searching for bugs this way, as you may discover that your bug has already been resolved and fixed in a later release. View | Details | Raw Unified | Return to bug 1508
Collapse All | Expand All

(-)a/src/kernel/ntqapplication.h (-1 / +3 lines)
Lines 352-362 private slots: Link Here
352
    void postIMEvent( TQObject *receiver, TQIMEvent *event );
352
    void postIMEvent( TQObject *receiver, TQIMEvent *event );
353
#endif
353
#endif
354
354
355
private:
355
public:
356
#ifdef QT_THREAD_SUPPORT
356
#ifdef QT_THREAD_SUPPORT
357
    static TQMutex   *tqt_mutex;
357
    static TQMutex   *tqt_mutex;
358
#endif // QT_THREAD_SUPPORT
358
#endif // QT_THREAD_SUPPORT
359
359
360
private:
360
    int		     app_argc;
361
    int		     app_argc;
361
    char	   **app_argv;
362
    char	   **app_argv;
362
    bool	     quit_now;
363
    bool	     quit_now;
Lines 434-439 private: Link Here
434
    friend class TQDialog;
435
    friend class TQDialog;
435
    friend class TQAccelManager;
436
    friend class TQAccelManager;
436
    friend class TQEvent;
437
    friend class TQEvent;
438
    friend class TQThread;
437
    friend class TQTranslator;
439
    friend class TQTranslator;
438
    friend class TQEventLoop;
440
    friend class TQEventLoop;
439
    friend Q_EXPORT void tqt_ucm_initialize( TQApplication * );
441
    friend Q_EXPORT void tqt_ucm_initialize( TQApplication * );
(-)a/src/kernel/ntqobject.h (+1 lines)
Lines 46-51 Link Here
46
#include "ntqwindowdefs.h"
46
#include "ntqwindowdefs.h"
47
#include "ntqstring.h"
47
#include "ntqstring.h"
48
#include "ntqevent.h"
48
#include "ntqevent.h"
49
#include "ntqmutex.h"
49
#include "ntqnamespace.h"
50
#include "ntqnamespace.h"
50
#endif // QT_H
51
#endif // QT_H
51
52
(-)a/src/kernel/ntqobjectdefs.h (+3 lines)
Lines 157-162 class TQMetaObject; Link Here
157
class TQSignal;
157
class TQSignal;
158
class TQConnection;
158
class TQConnection;
159
class TQEvent;
159
class TQEvent;
160
class TQMutex;
160
struct TQMetaData;
161
struct TQMetaData;
161
class TQConnectionList;
162
class TQConnectionList;
162
class TQConnectionListIt;
163
class TQConnectionListIt;
Lines 165-170 class TQObjectList; Link Here
165
class TQObjectListIt;
166
class TQObjectListIt;
166
class TQMemberDict;
167
class TQMemberDict;
167
168
169
extern TQMutex *tqt_sharedMetaObjectMutex;
170
168
Q_EXPORT void *tqt_find_obj_child( TQObject *, const char *, const char * );
171
Q_EXPORT void *tqt_find_obj_child( TQObject *, const char *, const char * );
169
#define Q_CHILD(parent,type,name) \
172
#define Q_CHILD(parent,type,name) \
170
	((type*)tqt_find_obj_child(parent,#type,name))
173
	((type*)tqt_find_obj_child(parent,#type,name))
(-)a/src/kernel/ntqstyle.h (-21 / +15 lines)
Lines 59-88 class TQTab; Link Here
59
class TQListViewItem;
59
class TQListViewItem;
60
class TQCheckListItem;
60
class TQCheckListItem;
61
61
62
class TQStyleOption {
62
class Q_EXPORT TQStyleOption {
63
public:
63
public:
64
    enum StyleOptionDefault { Default };
64
    enum StyleOptionDefault { Default };
65
65
66
    TQStyleOption(StyleOptionDefault=Default) : def(TRUE), tb(NULL), cli(NULL), tbh(NULL) {}
66
    TQStyleOption(StyleOptionDefault=Default);
67
67
    TQStyleOption(int in1);
68
    // Note: we don't use default arguments since that is unnecessary
68
    TQStyleOption(int in1, int in2);
69
    // initialization.
69
    TQStyleOption(int in1, int in2, int in3, int in4);
70
    TQStyleOption(int in1) :
70
    TQStyleOption(TQMenuItem* m);
71
	def(FALSE), tb(NULL), i1(in1), cli(NULL), tbh(NULL) {}
71
    TQStyleOption(TQMenuItem* m, int in1);
72
    TQStyleOption(int in1, int in2) :
72
    TQStyleOption(TQMenuItem* m, int in1, int in2);
73
	def(FALSE), tb(NULL), i1(in1), i2(in2), cli(NULL), tbh(NULL) {}
73
    TQStyleOption(const TQColor& c);
74
    TQStyleOption(int in1, int in2, int in3, int in4) :
74
    TQStyleOption(TQTab* t);
75
	def(FALSE), tb(NULL), i1(in1), i2(in2), i3(in3), i4(in4), cli(NULL), tbh(NULL) {}
75
    TQStyleOption(TQListViewItem* i);
76
    TQStyleOption(TQMenuItem* m) : def(FALSE), mi(m), tb(NULL), cli(NULL), tbh(NULL) {}
76
    TQStyleOption(TQCheckListItem* i);
77
    TQStyleOption(TQMenuItem* m, int in1) : def(FALSE), mi(m), tb(NULL), i1(in1), cli(NULL), tbh(NULL) {}
77
    TQStyleOption(TQt::ArrowType a);
78
    TQStyleOption(TQMenuItem* m, int in1, int in2) : def(FALSE), mi(m), tb(NULL), i1(in1), i2(in2), cli(NULL), tbh(NULL) {}
78
    TQStyleOption(const TQRect& r);
79
    TQStyleOption(const TQColor& c) : def(FALSE), tb(NULL), cl(&c), cli(NULL), tbh(NULL) {}
79
    TQStyleOption(TQWidget *w);
80
    TQStyleOption(TQTab* t) : def(FALSE), tb(t), cli(NULL), tbh(NULL) {}
81
    TQStyleOption(TQListViewItem* i) : def(FALSE), tb(NULL), li(i), cli(NULL), tbh(NULL) {}
82
    TQStyleOption(TQCheckListItem* i) : def(FALSE), tb(NULL), cli(i), tbh(NULL) {}
83
    TQStyleOption(TQt::ArrowType a) : def(FALSE), tb(NULL), i1((int)a), cli(NULL), tbh(NULL) {}
84
    TQStyleOption(const TQRect& r) : def(FALSE), tb(NULL), i1(r.x()), i2(r.y()), i3(r.width()), i4(r.height()), cli(NULL), tbh(NULL) {}
85
    TQStyleOption(TQWidget *w) : def(FALSE), tb(NULL), cli(NULL), p1((void*)w), tbh(NULL) {}
86
80
87
    bool isDefault() const { return def; }
81
    bool isDefault() const { return def; }
88
82
(-)a/src/kernel/qapplication.cpp (-31 / +58 lines)
Lines 377-384 int TQApplication::composedUnicode = 0; Link Here
377
377
378
#ifdef QT_THREAD_SUPPORT
378
#ifdef QT_THREAD_SUPPORT
379
TQMutex *TQApplication::tqt_mutex		= 0;
379
TQMutex *TQApplication::tqt_mutex		= 0;
380
static TQMutex *postevent_mutex		= 0;
380
TQMutex *tqt_sharedStringMutex			= 0;
381
static TQt::HANDLE tqt_application_thread_id = 0;
381
Q_EXPORT TQMutex * tqt_sharedMetaObjectMutex	= 0;
382
#ifdef QT_USE_GLIBMAINLOOP
383
TQMutex *tqt_timerListMutex			= 0;
384
#endif // QT_USE_GLIBMAINLOOP
385
static TQMutex *postevent_mutex			= 0;
386
static TQt::HANDLE tqt_application_thread_id	= 0;
382
Q_EXPORT TQt::HANDLE tqt_get_application_thread_id()
387
Q_EXPORT TQt::HANDLE tqt_get_application_thread_id()
383
{
388
{
384
    return tqt_application_thread_id;
389
    return tqt_application_thread_id;
Lines 600-605 static TQPostEventList *globalPostedEvents = 0; // list of posted events Link Here
600
605
601
uint qGlobalPostedEventsCount()
606
uint qGlobalPostedEventsCount()
602
{
607
{
608
#ifdef QT_THREAD_SUPPORT
609
    TQMutexLocker locker( postevent_mutex );
610
#endif // QT_THREAD_SUPPORT
611
603
    if (!globalPostedEvents) {
612
    if (!globalPostedEvents) {
604
	return 0;
613
	return 0;
605
    }
614
    }
Lines 1015-1020 void TQApplication::initialize( int argc, char **argv ) Link Here
1015
{
1024
{
1016
#ifdef QT_THREAD_SUPPORT
1025
#ifdef QT_THREAD_SUPPORT
1017
    tqt_mutex = new TQMutex( TRUE );
1026
    tqt_mutex = new TQMutex( TRUE );
1027
    tqt_sharedStringMutex = new TQMutex( TRUE );
1028
    tqt_sharedMetaObjectMutex = new TQMutex( TRUE );
1029
#ifdef QT_USE_GLIBMAINLOOP
1030
    tqt_timerListMutex = new TQMutex( TRUE );
1031
#endif // QT_USE_GLIBMAINLOOP
1018
    postevent_mutex = new TQMutex( TRUE );
1032
    postevent_mutex = new TQMutex( TRUE );
1019
    tqt_application_thread_id = TQThread::currentThread();
1033
    tqt_application_thread_id = TQThread::currentThread();
1020
#endif // QT_THREAD_SUPPORT
1034
#endif // QT_THREAD_SUPPORT
Lines 1184-1189 TQApplication::~TQApplication() Link Here
1184
    session_key = 0;
1198
    session_key = 0;
1185
#endif //QT_NO_SESSIONMANAGER
1199
#endif //QT_NO_SESSIONMANAGER
1186
1200
1201
#ifdef QT_THREAD_SUPPORT
1202
    delete tqt_sharedMetaObjectMutex;
1203
    tqt_sharedMetaObjectMutex = 0;
1204
    delete tqt_sharedStringMutex;
1205
    tqt_sharedStringMutex = 0;
1206
#ifdef QT_USE_GLIBMAINLOOP
1207
    delete tqt_timerListMutex;
1208
    tqt_timerListMutex = 0;
1209
#endif // QT_USE_GLIBMAINLOOP
1210
#endif // QT_THREAD_SUPPORT
1211
1187
    tqt_explicit_app_style = FALSE;
1212
    tqt_explicit_app_style = FALSE;
1188
    tqt_app_has_font = FALSE;
1213
    tqt_app_has_font = FALSE;
1189
    app_tracking = 0;
1214
    app_tracking = 0;
Lines 2425-2459 bool TQApplication::notify( TQObject *receiver, TQEvent *e ) Link Here
2425
	return FALSE;
2450
	return FALSE;
2426
    }
2451
    }
2427
2452
2428
    if ( e->type() == TQEvent::ChildRemoved && receiver->postedEvents && globalPostedEvents) {
2453
    if ( e->type() == TQEvent::ChildRemoved && receiver->postedEvents) {
2429
2430
#ifdef QT_THREAD_SUPPORT
2454
#ifdef QT_THREAD_SUPPORT
2431
	TQMutexLocker locker( postevent_mutex );
2455
	TQMutexLocker locker( postevent_mutex );
2432
#endif // QT_THREAD_SUPPORT
2456
#endif // QT_THREAD_SUPPORT
2433
2457
2434
	// the TQObject destructor calls TQObject::removeChild, which calls
2458
	if (globalPostedEvents) {
2435
	// TQApplication::sendEvent() directly.  this can happen while the event
2459
		// the TQObject destructor calls TQObject::removeChild, which calls
2436
	// loop is in the middle of posting events, and when we get here, we may
2460
		// TQApplication::sendEvent() directly.  this can happen while the event
2437
	// not have any more posted events for this object.
2461
		// loop is in the middle of posting events, and when we get here, we may
2438
	if ( receiver->postedEvents ) {
2462
		// not have any more posted events for this object.
2439
	    // if this is a child remove event and the child insert
2463
		if ( receiver->postedEvents ) {
2440
	    // hasn't been dispatched yet, kill that insert
2464
			// if this is a child remove event and the child insert
2441
	    TQPostEventList * l = receiver->postedEvents;
2465
			// hasn't been dispatched yet, kill that insert
2442
	    TQObject * c = ((TQChildEvent*)e)->child();
2466
			TQPostEventList * l = receiver->postedEvents;
2443
	    TQPostEvent * pe;
2467
			TQObject * c = ((TQChildEvent*)e)->child();
2444
	    l->first();
2468
			TQPostEvent * pe;
2445
	    while( ( pe = l->current()) != 0 ) {
2469
			l->first();
2446
		if ( pe->event && pe->receiver == receiver &&
2470
			while( ( pe = l->current()) != 0 ) {
2447
		     pe->event->type() == TQEvent::ChildInserted &&
2471
				if ( pe->event && pe->receiver == receiver &&
2448
		     ((TQChildEvent*)pe->event)->child() == c ) {
2472
					pe->event->type() == TQEvent::ChildInserted &&
2449
		    pe->event->posted = FALSE;
2473
					((TQChildEvent*)pe->event)->child() == c ) {
2450
		    delete pe->event;
2474
					pe->event->posted = FALSE;
2451
		    pe->event = 0;
2475
					delete pe->event;
2452
		    l->remove();
2476
					pe->event = 0;
2453
		    continue;
2477
					l->remove();
2478
					continue;
2479
				}
2480
				l->next();
2481
			}
2454
		}
2482
		}
2455
		l->next();
2456
	    }
2457
	}
2483
	}
2458
    }
2484
    }
2459
2485
Lines 3596-3603 void TQApplication::removePostedEvents( TQObject *receiver, int event_type ) Link Here
3596
3622
3597
void TQApplication::removePostedEvent( TQEvent *  event )
3623
void TQApplication::removePostedEvent( TQEvent *  event )
3598
{
3624
{
3599
    if ( !event || !event->posted )
3625
    if ( !event || !event->posted ) {
3600
	return;
3626
	return;
3627
    }
3628
3629
#ifdef QT_THREAD_SUPPORT
3630
    TQMutexLocker locker( postevent_mutex );
3631
#endif // QT_THREAD_SUPPORT
3601
3632
3602
    if ( !globalPostedEvents ) {
3633
    if ( !globalPostedEvents ) {
3603
#if defined(QT_DEBUG)
3634
#if defined(QT_DEBUG)
Lines 3607-3616 void TQApplication::removePostedEvent( TQEvent * event ) Link Here
3607
#endif
3638
#endif
3608
    }
3639
    }
3609
3640
3610
#ifdef QT_THREAD_SUPPORT
3611
    TQMutexLocker locker( postevent_mutex );
3612
#endif // QT_THREAD_SUPPORT
3613
3614
    TQPostEventListIt it( *globalPostedEvents );
3641
    TQPostEventListIt it( *globalPostedEvents );
3615
    TQPostEvent * pe;
3642
    TQPostEvent * pe;
3616
    while( (pe = it.current()) != 0 ) {
3643
    while( (pe = it.current()) != 0 ) {
(-)a/src/kernel/qeventloop_unix_glib.cpp (-29 / +46 lines)
Lines 55-60 Link Here
55
55
56
#include <glib.h>
56
#include <glib.h>
57
57
58
#ifdef QT_THREAD_SUPPORT
59
#ifdef QT_USE_GLIBMAINLOOP
60
extern TQMutex *tqt_timerListMutex;
61
#endif // QT_USE_GLIBMAINLOOP
62
#endif // QT_THREAD_SUPPORT
63
58
/*****************************************************************************
64
/*****************************************************************************
59
  Timer handling; UNIX has no application timer support so we'll have to
65
  Timer handling; UNIX has no application timer support so we'll have to
60
  make our own from scratch.
66
  make our own from scratch.
Lines 102-110 typedef TQPtrList<TimerInfo> TimerList; // list of TimerInfo structs Link Here
102
108
103
static TQBitArray *timerBitVec;			// timer bit vector
109
static TQBitArray *timerBitVec;			// timer bit vector
104
static TimerList  *timerList = 0;		// timer list
110
static TimerList  *timerList = 0;		// timer list
105
#if defined(QT_THREAD_SUPPORT)
106
static TQMutex    *timerListMutex = 0;		// timer list mutex
107
#endif
108
111
109
static void initTimers();
112
static void initTimers();
110
void cleanupTimers();
113
void cleanupTimers();
Lines 184-190 static int allocTimerId() // find avail timer identifier Link Here
184
static void insertTimer( const TimerInfo *ti )				// insert timer info into list
187
static void insertTimer( const TimerInfo *ti )				// insert timer info into list
185
{
188
{
186
#if defined(QT_THREAD_SUPPORT)
189
#if defined(QT_THREAD_SUPPORT)
187
	timerListMutex->lock();
190
	tqt_timerListMutex->lock();
188
#endif
191
#endif
189
	TimerInfo *t = timerList->first();
192
	TimerInfo *t = timerList->first();
190
	int index = 0;
193
	int index = 0;
Lines 207-213 static void insertTimer( const TimerInfo *ti ) // insert timer info into list Link Here
207
	}
210
	}
208
#endif
211
#endif
209
#if defined(QT_THREAD_SUPPORT)
212
#if defined(QT_THREAD_SUPPORT)
210
	timerListMutex->unlock();
213
	tqt_timerListMutex->unlock();
211
#endif
214
#endif
212
}
215
}
213
216
Lines 233-239 static inline void getTime( timeval &t ) // get time of day Link Here
233
static void repairTimer( const timeval &time )				// repair broken timer
236
static void repairTimer( const timeval &time )				// repair broken timer
234
{
237
{
235
#if defined(QT_THREAD_SUPPORT)
238
#if defined(QT_THREAD_SUPPORT)
236
	timerListMutex->lock();
239
	tqt_timerListMutex->lock();
237
#endif
240
#endif
238
	timeval diff = watchtime - time;
241
	timeval diff = watchtime - time;
239
	register TimerInfo *t = timerList->first();
242
	register TimerInfo *t = timerList->first();
Lines 242-248 static void repairTimer( const timeval &time ) // repair broken timer Link Here
242
		t = timerList->next();
245
		t = timerList->next();
243
	}
246
	}
244
#if defined(QT_THREAD_SUPPORT)
247
#if defined(QT_THREAD_SUPPORT)
245
	timerListMutex->unlock();
248
	tqt_timerListMutex->unlock();
246
#endif
249
#endif
247
}
250
}
248
251
Lines 260-266 static void repairTimer( const timeval &time ) // repair broken timer Link Here
260
timeval *qt_wait_timer()
263
timeval *qt_wait_timer()
261
{
264
{
262
#if defined(QT_THREAD_SUPPORT)
265
#if defined(QT_THREAD_SUPPORT)
263
	if (timerListMutex) timerListMutex->lock();
266
	tqt_timerListMutex->lock();
264
#endif
267
#endif
265
	static timeval tm;
268
	static timeval tm;
266
	bool first = TRUE;
269
	bool first = TRUE;
Lines 286-304 timeval *qt_wait_timer() Link Here
286
			tm = *qt_wait_timer_max;
289
			tm = *qt_wait_timer_max;
287
		}
290
		}
288
#if defined(QT_THREAD_SUPPORT)
291
#if defined(QT_THREAD_SUPPORT)
289
		if (timerListMutex) timerListMutex->unlock();
292
		tqt_timerListMutex->unlock();
290
#endif
293
#endif
291
		return &tm;
294
		return &tm;
292
	}
295
	}
293
	if ( qt_wait_timer_max ) {
296
	if ( qt_wait_timer_max ) {
294
		tm = *qt_wait_timer_max;
297
		tm = *qt_wait_timer_max;
295
#if defined(QT_THREAD_SUPPORT)
298
#if defined(QT_THREAD_SUPPORT)
296
		if (timerListMutex) timerListMutex->unlock();
299
		tqt_timerListMutex->unlock();
297
#endif
300
#endif
298
		return &tm;
301
		return &tm;
299
	}
302
	}
300
#if defined(QT_THREAD_SUPPORT)
303
#if defined(QT_THREAD_SUPPORT)
301
	if (timerListMutex) timerListMutex->unlock();
304
	tqt_timerListMutex->unlock();
302
#endif
305
#endif
303
	return 0;							// no timers
306
	return 0;							// no timers
304
}
307
}
Lines 314-320 static void initTimers() // initialize timers Link Here
314
	}
317
	}
315
	timerList = new TimerList;
318
	timerList = new TimerList;
316
#if defined(QT_THREAD_SUPPORT)
319
#if defined(QT_THREAD_SUPPORT)
317
	timerListMutex = new TQMutex(true);
320
	tqt_timerListMutex = new TQMutex(true);
318
#endif
321
#endif
319
	TQ_CHECK_PTR( timerList );
322
	TQ_CHECK_PTR( timerList );
320
	timerList->setAutoDelete( TRUE );
323
	timerList->setAutoDelete( TRUE );
Lines 328-347 void cleanupTimers() Link Here
328
	timerList = 0;
331
	timerList = 0;
329
	delete timerBitVec;
332
	delete timerBitVec;
330
	timerBitVec = 0;
333
	timerBitVec = 0;
331
#if defined(QT_THREAD_SUPPORT)
332
	delete timerListMutex;
333
	timerListMutex = 0;
334
#endif
335
}
334
}
336
335
337
// Main timer functions for starting and killing timers
336
// Main timer functions for starting and killing timers
338
int qStartTimer( int interval, TQObject *obj )
337
int qStartTimer( int interval, TQObject *obj )
339
{
338
{
339
#if defined(QT_THREAD_SUPPORT)
340
	if (tqt_timerListMutex) tqt_timerListMutex->lock();
341
#endif
340
	if ( !timerList ) {						// initialize timer data
342
	if ( !timerList ) {						// initialize timer data
341
		initTimers();
343
		initTimers();
344
#if defined(QT_THREAD_SUPPORT)
345
		if (tqt_timerListMutex) tqt_timerListMutex->lock();
346
#endif
342
	}
347
	}
343
	int id = allocTimerId();					// get free timer id
348
	int id = allocTimerId();					// get free timer id
344
	if ( (id <= 0) || (id > (int)timerBitVec->size()) || (!obj) ) {	// cannot create timer
349
	if ( (id <= 0) || (id > (int)timerBitVec->size()) || (!obj) ) {	// cannot create timer
350
#if defined(QT_THREAD_SUPPORT)
351
		if (tqt_timerListMutex) tqt_timerListMutex->unlock();
352
#endif
345
		return 0;
353
		return 0;
346
	}
354
	}
347
	timerBitVec->setBit( id-1 );					// set timer active
355
	timerBitVec->setBit( id-1 );					// set timer active
Lines 355-372 int qStartTimer( int interval, TQObject *obj ) Link Here
355
	t->timeout = currentTime + t->interval;
363
	t->timeout = currentTime + t->interval;
356
	t->obj = obj;
364
	t->obj = obj;
357
	insertTimer( t );						// put timer in list
365
	insertTimer( t );						// put timer in list
366
#if defined(QT_THREAD_SUPPORT)
367
	if (tqt_timerListMutex) tqt_timerListMutex->unlock();
368
#endif
358
	return id;
369
	return id;
359
}
370
}
360
371
361
bool qKillTimer( int id )
372
bool qKillTimer( int id )
362
{
373
{
374
#if defined(QT_THREAD_SUPPORT)
375
	if (tqt_timerListMutex) tqt_timerListMutex->lock();
376
#endif
363
	register TimerInfo *t;
377
	register TimerInfo *t;
364
	if ( (!timerList) || (id <= 0) || (id > (int)timerBitVec->size()) || (!timerBitVec->testBit( id-1 )) ) {
378
	if ( (!timerList) || (id <= 0) || (id > (int)timerBitVec->size()) || (!timerBitVec->testBit( id-1 )) ) {
365
		return FALSE;						// not init'd or invalid timer
366
	}
367
#if defined(QT_THREAD_SUPPORT)
379
#if defined(QT_THREAD_SUPPORT)
368
	timerListMutex->lock();
380
		if (tqt_timerListMutex) tqt_timerListMutex->unlock();
369
#endif
381
#endif
382
		return FALSE;						// not init'd or invalid timer
383
	}
370
	t = timerList->first();
384
	t = timerList->first();
371
	while ( t && t->id != id ) {					// find timer info in list
385
	while ( t && t->id != id ) {					// find timer info in list
372
		t = timerList->next();
386
		t = timerList->next();
Lines 376-388 bool qKillTimer( int id ) Link Here
376
		timerBitVec->clearBit( id-1 );				// set timer inactive
390
		timerBitVec->clearBit( id-1 );				// set timer inactive
377
		ret = timerList->remove();
391
		ret = timerList->remove();
378
#if defined(QT_THREAD_SUPPORT)
392
#if defined(QT_THREAD_SUPPORT)
379
		timerListMutex->unlock();
393
		if (tqt_timerListMutex) tqt_timerListMutex->unlock();
380
#endif
394
#endif
381
		return ret;
395
		return ret;
382
	}
396
	}
383
	else {								// id not found
397
	else {								// id not found
384
#if defined(QT_THREAD_SUPPORT)
398
#if defined(QT_THREAD_SUPPORT)
385
		timerListMutex->unlock();
399
		if (tqt_timerListMutex) tqt_timerListMutex->unlock();
386
#endif
400
#endif
387
		return FALSE;
401
		return FALSE;
388
	}
402
	}
Lines 390-402 bool qKillTimer( int id ) Link Here
390
404
391
bool qKillTimer( TQObject *obj )
405
bool qKillTimer( TQObject *obj )
392
{
406
{
407
#if defined(QT_THREAD_SUPPORT)
408
	if (tqt_timerListMutex) tqt_timerListMutex->lock();
409
#endif
393
	register TimerInfo *t;
410
	register TimerInfo *t;
394
	if ( !timerList ) {						// not initialized
411
	if ( !timerList ) {						// not initialized
395
		return FALSE;
396
	}
397
#if defined(QT_THREAD_SUPPORT)
412
#if defined(QT_THREAD_SUPPORT)
398
	timerListMutex->lock();
413
		if (tqt_timerListMutex) tqt_timerListMutex->unlock();
399
#endif
414
#endif
415
		return FALSE;
416
	}
400
	t = timerList->first();
417
	t = timerList->first();
401
	while ( t ) {							// check all timers
418
	while ( t ) {							// check all timers
402
		if ( t->obj == obj ) {					// object found
419
		if ( t->obj == obj ) {					// object found
Lines 409-415 bool qKillTimer( TQObject *obj ) Link Here
409
		}
426
		}
410
	}
427
	}
411
#if defined(QT_THREAD_SUPPORT)
428
#if defined(QT_THREAD_SUPPORT)
412
	timerListMutex->unlock();
429
	if (tqt_timerListMutex) tqt_timerListMutex->unlock();
413
#endif
430
#endif
414
	return TRUE;
431
	return TRUE;
415
}
432
}
Lines 619-625 int TQEventLoop::activateTimers() Link Here
619
		return 0;
636
		return 0;
620
	}
637
	}
621
#if defined(QT_THREAD_SUPPORT)
638
#if defined(QT_THREAD_SUPPORT)
622
	timerListMutex->lock();
639
	tqt_timerListMutex->lock();
623
#endif
640
#endif
624
	bool first = TRUE;
641
	bool first = TRUE;
625
	timeval currentTime;
642
	timeval currentTime;
Lines 663-669 int TQEventLoop::activateTimers() Link Here
663
			n_act++;
680
			n_act++;
664
		}
681
		}
665
#if defined(QT_THREAD_SUPPORT)
682
#if defined(QT_THREAD_SUPPORT)
666
		timerListMutex->unlock();
683
		tqt_timerListMutex->unlock();
667
#endif
684
#endif
668
		TQTimerEvent e( t->id );
685
		TQTimerEvent e( t->id );
669
#if defined(QT_THREAD_SUPPORT)
686
#if defined(QT_THREAD_SUPPORT)
Lines 678-691 int TQEventLoop::activateTimers() Link Here
678
		TQApplication::sendEvent( t->obj, &e );					// send event
695
		TQApplication::sendEvent( t->obj, &e );					// send event
679
#endif // defined(QT_THREAD_SUPPORT)
696
#endif // defined(QT_THREAD_SUPPORT)
680
#if defined(QT_THREAD_SUPPORT)
697
#if defined(QT_THREAD_SUPPORT)
681
		timerListMutex->lock();
698
		tqt_timerListMutex->lock();
682
#endif
699
#endif
683
		if ( timerList->findRef( begin ) == -1 ) {
700
		if ( timerList->findRef( begin ) == -1 ) {
684
			begin = 0;
701
			begin = 0;
685
		}
702
		}
686
	}
703
	}
687
#if defined(QT_THREAD_SUPPORT)
704
#if defined(QT_THREAD_SUPPORT)
688
	timerListMutex->unlock();
705
	tqt_timerListMutex->unlock();
689
#endif
706
#endif
690
	return n_act;
707
	return n_act;
691
}
708
}
(-)a/src/kernel/qeventloop_x11_glib.cpp (+4 lines)
Lines 629-634 bool TQEventLoop::gsourceDispatch(GSource *gs) { Link Here
629
629
630
bool TQEventLoop::hasPendingEvents() const
630
bool TQEventLoop::hasPendingEvents() const
631
{
631
{
632
#ifdef QT_THREAD_SUPPORT
633
	TQMutexLocker locker( TQApplication::tqt_mutex );
634
#endif // QT_THREAD_SUPPORT
635
632
	extern uint qGlobalPostedEventsCount(); // from qapplication.cpp
636
	extern uint qGlobalPostedEventsCount(); // from qapplication.cpp
633
	return ( qGlobalPostedEventsCount() || ( (tqt_is_gui_used && TQApplication::isGuiThread())  ? XPending( TQPaintDevice::x11AppDisplay() ) : 0));
637
	return ( qGlobalPostedEventsCount() || ( (tqt_is_gui_used && TQApplication::isGuiThread())  ? XPending( TQPaintDevice::x11AppDisplay() ) : 0));
634
}
638
}
(-)a/src/kernel/qobject.cpp (-20 / +170 lines)
Lines 73-78 public: Link Here
73
    }
73
    }
74
#endif
74
#endif
75
    TQThread* ownThread;
75
    TQThread* ownThread;
76
    TQMutex* senderObjectListMutex;
77
    TQMutex* childObjectListMutex;
76
    bool disableThreadPostedEvents;
78
    bool disableThreadPostedEvents;
77
};
79
};
78
80
Lines 83-88 void TQObject::moveToThread_helper(TQThread *targetThread) Link Here
83
    TQEvent e(TQEvent::ThreadChange);
85
    TQEvent e(TQEvent::ThreadChange);
84
    TQApplication::sendEvent(this, &e);
86
    TQApplication::sendEvent(this, &e);
85
87
88
#ifdef QT_THREAD_SUPPORT
89
    TQMutexLocker locker( d->childObjectListMutex );
90
#endif // QT_THREAD_SUPPORT
91
86
    if (childObjects) {
92
    if (childObjects) {
87
        TQObject *child;
93
        TQObject *child;
88
        TQObjectListIt it(*childObjects);
94
        TQObjectListIt it(*childObjects);
Lines 97-102 void TQObject::setThreadObject_helper(TQThread *targetThread) Link Here
97
{
103
{
98
    d->ownThread = targetThread;
104
    d->ownThread = targetThread;
99
105
106
#ifdef QT_THREAD_SUPPORT
107
    TQMutexLocker locker( d->childObjectListMutex );
108
#endif // QT_THREAD_SUPPORT
109
100
    if (childObjects) {
110
    if (childObjects) {
101
        TQObject *child;
111
        TQObject *child;
102
        TQObjectListIt it(*childObjects);
112
        TQObjectListIt it(*childObjects);
Lines 123-129 void TQObject::setThreadObject_helper(TQThread *targetThread) Link Here
123
 */
133
 */
124
void TQObject::moveToThread(TQThread *targetThread)
134
void TQObject::moveToThread(TQThread *targetThread)
125
{
135
{
136
#ifdef QT_THREAD_SUPPORT
126
    TQMutexLocker locker( TQApplication::tqt_mutex );
137
    TQMutexLocker locker( TQApplication::tqt_mutex );
138
#endif // QT_THREAD_SUPPORT
127
139
128
    if (parentObj) {
140
    if (parentObj) {
129
#if defined(QT_DEBUG)
141
#if defined(QT_DEBUG)
Lines 179-189 void TQObject::disableThreadPostedEvents(bool disable) { Link Here
179
191
180
class TQSenderObjectList : public TQObjectList, public TQShared
192
class TQSenderObjectList : public TQObjectList, public TQShared
181
{
193
{
182
public:
194
	public:
183
    TQSenderObjectList() : currentSender( 0 ) { }
195
		TQSenderObjectList();
184
    TQObject *currentSender;
196
		~TQSenderObjectList();
197
	
198
	public:
199
		TQObject *currentSender;
200
		TQMutex *listMutex;
185
};
201
};
186
202
203
TQSenderObjectList::TQSenderObjectList() : currentSender( 0 ) {
204
	listMutex = new TQMutex( TRUE );
205
}
206
207
TQSenderObjectList::~TQSenderObjectList() {
208
	delete listMutex;
209
}
210
187
class Q_EXPORT TQMetaCallEvent : public TQEvent
211
class Q_EXPORT TQMetaCallEvent : public TQEvent
188
{
212
{
189
public:
213
public:
Lines 369-376 bool qKillTimer( TQObject *obj ); Link Here
369
static void removeObjFromList( TQObjectList *objList, const TQObject *obj,
393
static void removeObjFromList( TQObjectList *objList, const TQObject *obj,
370
			       bool single=FALSE )
394
			       bool single=FALSE )
371
{
395
{
372
    if ( !objList )
396
    if ( !objList ) {
373
	return;
397
	return;
398
    }
374
    int index = objList->findRef( obj );
399
    int index = objList->findRef( obj );
375
    while ( index >= 0 ) {
400
    while ( index >= 0 ) {
376
	objList->remove();
401
	objList->remove();
Lines 585-592 TQObject::TQObject( TQObject *parent, const char *name ) Link Here
585
    postedEvents( 0 ), 				// no events posted
610
    postedEvents( 0 ), 				// no events posted
586
    d( 0 )
611
    d( 0 )
587
{
612
{
588
    if ( !metaObj )				// will create object dict
613
    if ( !d ) {
614
	d = new TQObjectPrivate(0);
615
    }
616
617
    d->ownThread = TQThread::currentThreadObject();
618
    d->senderObjectListMutex = new TQMutex( TRUE );
619
    d->childObjectListMutex = new TQMutex( TRUE );
620
621
    if ( !metaObj ) {				// will create object dict
589
	(void) staticMetaObject();
622
	(void) staticMetaObject();
623
    }
590
624
591
    if ( parent ) {				// add object to parent
625
    if ( parent ) {				// add object to parent
592
	parent->insertChild( this );
626
	parent->insertChild( this );
Lines 594-604 TQObject::TQObject( TQObject *parent, const char *name ) Link Here
594
	insert_tree( this );
628
	insert_tree( this );
595
	isTree = TRUE;
629
	isTree = TRUE;
596
    }
630
    }
597
598
    if ( !d )
599
	d = new TQObjectPrivate(0);
600
601
    d->ownThread = TQThread::currentThreadObject();
602
}
631
}
603
632
604
633
Lines 634-639 TQObject::~TQObject() Link Here
634
    blockSig = 0; // unblock signals to keep TQGuardedPtr happy
663
    blockSig = 0; // unblock signals to keep TQGuardedPtr happy
635
    emit destroyed( this );
664
    emit destroyed( this );
636
    emit destroyed();
665
    emit destroyed();
666
637
    if ( objname ) {
667
    if ( objname ) {
638
	delete [] (char*)objname;
668
	delete [] (char*)objname;
639
    }
669
    }
Lines 669-676 TQObject::~TQObject() Link Here
669
	    TQConnectionListIt cit(*clist);
699
	    TQConnectionListIt cit(*clist);
670
	    while( (c=cit.current()) ) {	// for each connected slot...
700
	    while( (c=cit.current()) ) {	// for each connected slot...
671
		++cit;
701
		++cit;
672
		if ( (obj=c->object()) )
702
		if ( (obj=c->object()) ) {
673
		    removeObjFromList( obj->senderObjects, this );
703
		    removeObjFromList( obj->senderObjects, this );
704
		}
674
	    }
705
	    }
675
	}
706
	}
676
	delete connections;
707
	delete connections;
Lines 691-696 TQObject::~TQObject() Link Here
691
	delete childObjects;
722
	delete childObjects;
692
    }
723
    }
693
724
725
#ifdef QT_THREAD_SUPPORT
726
    delete d->childObjectListMutex;
727
    delete d->senderObjectListMutex;
728
#endif // QT_THREAD_SUPPORT
729
694
    delete d;
730
    delete d;
695
}
731
}
696
732
Lines 985-995 bool TQObject::event( TQEvent *e ) Link Here
985
		    TQSenderObjectList* sol;
1021
		    TQSenderObjectList* sol;
986
		    TQObject* oldSender = 0;
1022
		    TQObject* oldSender = 0;
987
		    sol = senderObjects;
1023
		    sol = senderObjects;
1024
#ifdef QT_THREAD_SUPPORT
1025
		    sol->listMutex->lock();
1026
#endif // QT_THREAD_SUPPORT
988
		    if ( sol ) {
1027
		    if ( sol ) {
989
			oldSender = sol->currentSender;
1028
			oldSender = sol->currentSender;
990
			sol->ref();
1029
			sol->ref();
991
			sol->currentSender = metaEvent->sender();
1030
			sol->currentSender = metaEvent->sender();
992
		    }
1031
		    }
1032
#ifdef QT_THREAD_SUPPORT
1033
		    sol->listMutex->unlock();
1034
#endif // QT_THREAD_SUPPORT
993
		    TQUObject *o = metaEvent->data();
1035
		    TQUObject *o = metaEvent->data();
994
		    if (metaEvent->type() == TQMetaCallEvent::MetaCallEmit) {
1036
		    if (metaEvent->type() == TQMetaCallEvent::MetaCallEmit) {
995
			tqt_emit( metaEvent->id(), o );
1037
			tqt_emit( metaEvent->id(), o );
Lines 997-1008 bool TQObject::event( TQEvent *e ) Link Here
997
		    if (metaEvent->type() == TQMetaCallEvent::MetaCallInvoke) {
1039
		    if (metaEvent->type() == TQMetaCallEvent::MetaCallInvoke) {
998
			tqt_invoke( metaEvent->id(), o );
1040
			tqt_invoke( metaEvent->id(), o );
999
		    }
1041
		    }
1042
#ifdef QT_THREAD_SUPPORT
1043
		    sol->listMutex->lock();
1044
#endif // QT_THREAD_SUPPORT
1000
		    if (sol ) {
1045
		    if (sol ) {
1001
			sol->currentSender = oldSender;
1046
			sol->currentSender = oldSender;
1002
			if ( sol->deref() ) {
1047
			if ( sol->deref() ) {
1048
			    sol->listMutex->unlock();
1003
			    delete sol;
1049
			    delete sol;
1050
			    sol = NULL;
1004
			}
1051
			}
1005
		    }
1052
		    }
1053
#ifdef QT_THREAD_SUPPORT
1054
		    if (sol) sol->listMutex->unlock();
1055
#endif // QT_THREAD_SUPPORT
1006
		}
1056
		}
1007
		else {
1057
		else {
1008
		    tqWarning("TQObject: Ignoring metacall event from non-owning thread");
1058
		    tqWarning("TQObject: Ignoring metacall event from non-owning thread");
Lines 1509-1514 TQConnectionList *TQObject::receivers( int signal ) const Link Here
1509
1559
1510
void TQObject::insertChild( TQObject *obj )
1560
void TQObject::insertChild( TQObject *obj )
1511
{
1561
{
1562
#ifdef QT_THREAD_SUPPORT
1563
	TQMutexLocker locker( d->childObjectListMutex );
1564
#endif // QT_THREAD_SUPPORT
1565
1512
    if ( obj->isTree ) {
1566
    if ( obj->isTree ) {
1513
	remove_tree( obj );
1567
	remove_tree( obj );
1514
	obj->isTree = FALSE;
1568
	obj->isTree = FALSE;
Lines 1551-1556 void TQObject::insertChild( TQObject *obj ) Link Here
1551
1605
1552
void TQObject::removeChild( TQObject *obj )
1606
void TQObject::removeChild( TQObject *obj )
1553
{
1607
{
1608
#ifdef QT_THREAD_SUPPORT
1609
	TQMutexLocker locker( d->childObjectListMutex );
1610
#endif // QT_THREAD_SUPPORT
1611
1554
    if ( childObjects && childObjects->removeRef(obj) ) {
1612
    if ( childObjects && childObjects->removeRef(obj) ) {
1555
	obj->parentObj = 0;
1613
	obj->parentObj = 0;
1556
	if ( !obj->wasDeleted ) {
1614
	if ( !obj->wasDeleted ) {
Lines 2135-2143 void TQObject::connectInternal( const TQObject *sender, int signal_index, const Link Here
2135
    TQConnection *c = new TQConnection( r, member_index, rm ? rm->name : "qt_invoke", membcode );
2193
    TQConnection *c = new TQConnection( r, member_index, rm ? rm->name : "qt_invoke", membcode );
2136
    TQ_CHECK_PTR( c );
2194
    TQ_CHECK_PTR( c );
2137
    clist->append( c );
2195
    clist->append( c );
2138
    if ( !r->senderObjects )			// create list of senders
2196
    if ( !r->senderObjects ) {			// create list of senders
2197
#ifdef QT_THREAD_SUPPORT
2198
	r->d->senderObjectListMutex->lock();
2199
#endif // QT_THREAD_SUPPORT
2139
	r->senderObjects = new TQSenderObjectList;
2200
	r->senderObjects = new TQSenderObjectList;
2201
#ifdef QT_THREAD_SUPPORT
2202
	r->senderObjects->listMutex->lock();
2203
	r->d->senderObjectListMutex->unlock();
2204
#endif // QT_THREAD_SUPPORT
2205
    }
2206
    else {
2207
#ifdef QT_THREAD_SUPPORT
2208
	r->senderObjects->listMutex->lock();
2209
#endif // QT_THREAD_SUPPORT
2210
    }
2140
    r->senderObjects->append( s );		// add sender to list
2211
    r->senderObjects->append( s );		// add sender to list
2212
#ifdef QT_THREAD_SUPPORT
2213
    r->senderObjects->listMutex->unlock();
2214
#endif // QT_THREAD_SUPPORT
2141
}
2215
}
2142
2216
2143
2217
Lines 2343-2355 bool TQObject::disconnectInternal( const TQObject *sender, int signal_index, Link Here
2343
	    c = clist->first();
2417
	    c = clist->first();
2344
	    while ( c ) {			// for all receivers...
2418
	    while ( c ) {			// for all receivers...
2345
		if ( r == 0 ) {			// remove all receivers
2419
		if ( r == 0 ) {			// remove all receivers
2420
#ifdef QT_THREAD_SUPPORT
2421
		    if (c->object()->senderObjects) c->object()->senderObjects->listMutex->lock();
2422
#endif // QT_THREAD_SUPPORT
2346
		    removeObjFromList( c->object()->senderObjects, s );
2423
		    removeObjFromList( c->object()->senderObjects, s );
2424
#ifdef QT_THREAD_SUPPORT
2425
		    if (c->object()->senderObjects) c->object()->senderObjects->listMutex->unlock();
2426
#endif // QT_THREAD_SUPPORT
2347
		    success = TRUE;
2427
		    success = TRUE;
2348
		    c = clist->next();
2428
		    c = clist->next();
2349
		} else if ( r == c->object() &&
2429
		} else if ( r == c->object() &&
2350
			    ( (member_index == -1) ||
2430
			    ( (member_index == -1) ||
2351
			      ((member_index == c->member()) && (c->memberType() == membcode)) ) ) {
2431
			      ((member_index == c->member()) && (c->memberType() == membcode)) ) ) {
2432
#ifdef QT_THREAD_SUPPORT
2433
		    if (c->object()->senderObjects) c->object()->senderObjects->listMutex->lock();
2434
#endif // QT_THREAD_SUPPORT
2352
		    removeObjFromList( c->object()->senderObjects, s, TRUE );
2435
		    removeObjFromList( c->object()->senderObjects, s, TRUE );
2436
#ifdef QT_THREAD_SUPPORT
2437
		    if (c->object()->senderObjects) c->object()->senderObjects->listMutex->unlock();
2438
#endif // QT_THREAD_SUPPORT
2353
		    success = TRUE;
2439
		    success = TRUE;
2354
		    clist->remove();
2440
		    clist->remove();
2355
		    c = clist->current();
2441
		    c = clist->current();
Lines 2368-2380 bool TQObject::disconnectInternal( const TQObject *sender, int signal_index, Link Here
2368
	c = clist->first();
2454
	c = clist->first();
2369
	while ( c ) {				// for all receivers...
2455
	while ( c ) {				// for all receivers...
2370
	    if ( r == 0 ) {			// remove all receivers
2456
	    if ( r == 0 ) {			// remove all receivers
2457
#ifdef QT_THREAD_SUPPORT
2458
		    if (c->object()->senderObjects) c->object()->senderObjects->listMutex->lock();
2459
#endif // QT_THREAD_SUPPORT
2371
		removeObjFromList( c->object()->senderObjects, s, TRUE );
2460
		removeObjFromList( c->object()->senderObjects, s, TRUE );
2461
#ifdef QT_THREAD_SUPPORT
2462
		    if (c->object()->senderObjects) c->object()->senderObjects->listMutex->unlock();
2463
#endif // QT_THREAD_SUPPORT
2372
		success = TRUE;
2464
		success = TRUE;
2373
		c = clist->next();
2465
		c = clist->next();
2374
	    } else if ( r == c->object() &&
2466
	    } else if ( r == c->object() &&
2375
			( (member_index == -1) ||
2467
			( (member_index == -1) ||
2376
			  ((member_index == c->member()) && (c->memberType() == membcode)) ) ) {
2468
			  ((member_index == c->member()) && (c->memberType() == membcode)) ) ) {
2469
#ifdef QT_THREAD_SUPPORT
2470
		    if (c->object()->senderObjects) c->object()->senderObjects->listMutex->lock();
2471
#endif // QT_THREAD_SUPPORT
2377
		removeObjFromList( c->object()->senderObjects, s, TRUE );
2472
		removeObjFromList( c->object()->senderObjects, s, TRUE );
2473
#ifdef QT_THREAD_SUPPORT
2474
		    if (c->object()->senderObjects) c->object()->senderObjects->listMutex->unlock();
2475
#endif // QT_THREAD_SUPPORT
2378
		success = TRUE;
2476
		success = TRUE;
2379
		clist->remove();
2477
		clist->remove();
2380
		c = clist->current();
2478
		c = clist->current();
Lines 2382-2389 bool TQObject::disconnectInternal( const TQObject *sender, int signal_index, Link Here
2382
		c = clist->next();
2480
		c = clist->next();
2383
	    }
2481
	    }
2384
	}
2482
	}
2385
	if ( r == 0 )				// disconnect all receivers
2483
	if ( r == 0 ) {				// disconnect all receivers
2386
	    s->connections->insert( signal_index, 0 );
2484
	    s->connections->insert( signal_index, 0 );
2485
	}
2387
    }
2486
    }
2388
    return success;
2487
    return success;
2389
}
2488
}
Lines 2578-2588 void TQObject::activate_signal( int signal ) Link Here
2578
    }
2677
    }
2579
#endif
2678
#endif
2580
2679
2581
    if ( !connections || signalsBlocked() || signal < 0 )
2680
    if ( !connections || signalsBlocked() || signal < 0 ) {
2582
	return;
2681
	return;
2682
    }
2583
    TQConnectionList *clist = connections->at( signal );
2683
    TQConnectionList *clist = connections->at( signal );
2584
    if ( !clist )
2684
    if ( !clist ) {
2585
	return;
2685
	return;
2686
    }
2586
    TQUObject o[1];
2687
    TQUObject o[1];
2587
    o[0].isLastObject = true;
2688
    o[0].isLastObject = true;
2588
    activate_signal( clist, o );
2689
    activate_signal( clist, o );
Lines 2592-2603 void TQObject::activate_signal( int signal ) Link Here
2592
2693
2593
void TQObject::activate_signal( TQConnectionList *clist, TQUObject *o )
2694
void TQObject::activate_signal( TQConnectionList *clist, TQUObject *o )
2594
{
2695
{
2595
    if ( !clist )
2696
    if ( !clist ) {
2596
	return;
2697
	return;
2698
    }
2597
2699
2598
#ifndef QT_NO_PRELIMINARY_SIGNAL_SPY
2700
#ifndef QT_NO_PRELIMINARY_SIGNAL_SPY
2599
    if ( tqt_preliminary_signal_spy )
2701
    if ( tqt_preliminary_signal_spy ) {
2600
	qt_spy_signal( this, connections->findRef( clist), o );
2702
	qt_spy_signal( this, connections->findRef( clist), o );
2703
    }
2601
#endif
2704
#endif
2602
2705
2603
    const TQThread *currentThread = TQThread::currentThreadObject();
2706
    const TQThread *currentThread = TQThread::currentThreadObject();
Lines 2610-2615 void TQObject::activate_signal( TQConnectionList *clist, TQUObject *o ) Link Here
2610
	c = clist->first();
2713
	c = clist->first();
2611
	object = c->object();
2714
	object = c->object();
2612
	sol = object->senderObjects;
2715
	sol = object->senderObjects;
2716
#ifdef QT_THREAD_SUPPORT
2717
	sol->listMutex->lock();
2718
#endif // QT_THREAD_SUPPORT
2613
	if ( sol ) {
2719
	if ( sol ) {
2614
	    oldSender = sol->currentSender;
2720
	    oldSender = sol->currentSender;
2615
	    sol->ref();
2721
	    sol->ref();
Lines 2617-2623 void TQObject::activate_signal( TQConnectionList *clist, TQUObject *o ) Link Here
2617
	}
2723
	}
2618
	if ( c->memberType() == TQSIGNAL_CODE ) {
2724
	if ( c->memberType() == TQSIGNAL_CODE ) {
2619
	    if ((d->disableThreadPostedEvents) || (object->d->ownThread == currentThread)) {
2725
	    if ((d->disableThreadPostedEvents) || (object->d->ownThread == currentThread)) {
2726
#ifdef QT_THREAD_SUPPORT
2727
		sol->listMutex->unlock();
2728
#endif // QT_THREAD_SUPPORT
2620
		object->tqt_emit( c->member(), o );
2729
		object->tqt_emit( c->member(), o );
2730
#ifdef QT_THREAD_SUPPORT
2731
		sol->listMutex->lock();
2732
#endif // QT_THREAD_SUPPORT
2621
	    }
2733
	    }
2622
	    else {
2734
	    else {
2623
		if (object->d->ownThread && !object->d->ownThread->finished()) {
2735
		if (object->d->ownThread && !object->d->ownThread->finished()) {
Lines 2627-2633 void TQObject::activate_signal( TQConnectionList *clist, TQUObject *o ) Link Here
2627
	}
2739
	}
2628
	else {
2740
	else {
2629
	    if ((d->disableThreadPostedEvents) || (object->d->ownThread == currentThread)) {
2741
	    if ((d->disableThreadPostedEvents) || (object->d->ownThread == currentThread)) {
2742
#ifdef QT_THREAD_SUPPORT
2743
		sol->listMutex->unlock();
2744
#endif // QT_THREAD_SUPPORT
2630
		object->tqt_invoke( c->member(), o );
2745
		object->tqt_invoke( c->member(), o );
2746
#ifdef QT_THREAD_SUPPORT
2747
		sol->listMutex->lock();
2748
#endif // QT_THREAD_SUPPORT
2631
	    }
2749
	    }
2632
	    else {
2750
	    else {
2633
		if (object->d->ownThread && !object->d->ownThread->finished()) {
2751
		if (object->d->ownThread && !object->d->ownThread->finished()) {
Lines 2637-2645 void TQObject::activate_signal( TQConnectionList *clist, TQUObject *o ) Link Here
2637
	}
2755
	}
2638
	if ( sol ) {
2756
	if ( sol ) {
2639
	    sol->currentSender = oldSender;
2757
	    sol->currentSender = oldSender;
2640
	    if ( sol->deref() )
2758
	    if ( sol->deref() ) {
2759
	        sol->listMutex->unlock();
2641
		delete sol;
2760
		delete sol;
2761
		sol = NULL;
2762
	    }
2642
	}
2763
	}
2764
#ifdef QT_THREAD_SUPPORT
2765
	if (sol) sol->listMutex->unlock();
2766
#endif // QT_THREAD_SUPPORT
2643
    } else {
2767
    } else {
2644
	TQConnection *cd = 0;
2768
	TQConnection *cd = 0;
2645
	TQConnectionListIt it(*clist);
2769
	TQConnectionListIt it(*clist);
Lines 2650-2655 void TQObject::activate_signal( TQConnectionList *clist, TQUObject *o ) Link Here
2650
	    cd = c;
2774
	    cd = c;
2651
	    object = c->object();
2775
	    object = c->object();
2652
	    sol = object->senderObjects;
2776
	    sol = object->senderObjects;
2777
#ifdef QT_THREAD_SUPPORT
2778
	sol->listMutex->lock();
2779
#endif // QT_THREAD_SUPPORT
2653
	    if ( sol ) {
2780
	    if ( sol ) {
2654
		oldSender = sol->currentSender;
2781
		oldSender = sol->currentSender;
2655
		sol->ref();
2782
		sol->ref();
Lines 2657-2663 void TQObject::activate_signal( TQConnectionList *clist, TQUObject *o ) Link Here
2657
	    }
2784
	    }
2658
	    if ( c->memberType() == TQSIGNAL_CODE ) {
2785
	    if ( c->memberType() == TQSIGNAL_CODE ) {
2659
		if ((d->disableThreadPostedEvents) || (object->d->ownThread == currentThread)) {
2786
		if ((d->disableThreadPostedEvents) || (object->d->ownThread == currentThread)) {
2787
#ifdef QT_THREAD_SUPPORT
2788
		    sol->listMutex->unlock();
2789
#endif // QT_THREAD_SUPPORT
2660
		    object->tqt_emit( c->member(), o );
2790
		    object->tqt_emit( c->member(), o );
2791
#ifdef QT_THREAD_SUPPORT
2792
		    sol->listMutex->lock();
2793
#endif // QT_THREAD_SUPPORT
2661
		}
2794
		}
2662
		else {
2795
		else {
2663
		    if (object->d->ownThread && !object->d->ownThread->finished()) {
2796
		    if (object->d->ownThread && !object->d->ownThread->finished()) {
Lines 2667-2673 void TQObject::activate_signal( TQConnectionList *clist, TQUObject *o ) Link Here
2667
	    }
2800
	    }
2668
	    else {
2801
	    else {
2669
		if ((d->disableThreadPostedEvents) || (object->d->ownThread == currentThread)) {
2802
		if ((d->disableThreadPostedEvents) || (object->d->ownThread == currentThread)) {
2803
#ifdef QT_THREAD_SUPPORT
2804
		    sol->listMutex->unlock();
2805
#endif // QT_THREAD_SUPPORT
2670
		    object->tqt_invoke( c->member(), o );
2806
		    object->tqt_invoke( c->member(), o );
2807
#ifdef QT_THREAD_SUPPORT
2808
		    sol->listMutex->lock();
2809
#endif // QT_THREAD_SUPPORT
2671
		}
2810
		}
2672
		else {
2811
		else {
2673
		    if (object->d->ownThread && !object->d->ownThread->finished()) {
2812
		    if (object->d->ownThread && !object->d->ownThread->finished()) {
Lines 2677-2685 void TQObject::activate_signal( TQConnectionList *clist, TQUObject *o ) Link Here
2677
	    }
2816
	    }
2678
	    if (sol ) {
2817
	    if (sol ) {
2679
		sol->currentSender = oldSender;
2818
		sol->currentSender = oldSender;
2680
		if ( sol->deref() )
2819
		if ( sol->deref() ) {
2820
		    sol->listMutex->unlock();
2681
		    delete sol;
2821
		    delete sol;
2822
		    sol = NULL;
2823
		}
2682
	    }
2824
	    }
2825
#ifdef QT_THREAD_SUPPORT
2826
	    if (sol) sol->listMutex->unlock();
2827
#endif // QT_THREAD_SUPPORT
2683
	}
2828
	}
2684
    }
2829
    }
2685
}
2830
}
Lines 2818-2823 void TQObject::dumpObjectTree() Link Here
2818
2963
2819
void TQObject::dumpObjectInfo()
2964
void TQObject::dumpObjectInfo()
2820
{
2965
{
2966
#ifdef QT_THREAD_SUPPORT
2967
    TQMutexLocker locker( d->senderObjectListMutex );
2968
#endif // QT_THREAD_SUPPORT
2969
2821
#if defined(QT_DEBUG)
2970
#if defined(QT_DEBUG)
2822
    tqDebug( "OBJECT %s::%s", className(), name( "unnamed" ) );
2971
    tqDebug( "OBJECT %s::%s", className(), name( "unnamed" ) );
2823
    int n = 0;
2972
    int n = 0;
Lines 2852-2859 void TQObject::dumpObjectInfo() Link Here
2852
	    sender = senderObjects->next();
3001
	    sender = senderObjects->next();
2853
	}
3002
	}
2854
    }
3003
    }
2855
    if ( n == 0 )
3004
    if ( n == 0 ) {
2856
	tqDebug( "\t<None>" );
3005
	tqDebug( "\t<None>" );
3006
    }
2857
#endif
3007
#endif
2858
}
3008
}
2859
3009
(-)a/src/kernel/qstyle.cpp (+188 lines)
Lines 62-67 public: Link Here
62
    }
62
    }
63
};
63
};
64
64
65
TQStyleOption::TQStyleOption(StyleOptionDefault) :
66
	def(TRUE),
67
	tb(NULL),
68
	i1(-1),
69
	i2(-1),
70
	i3(-1),
71
	i4(-1),
72
	i5(-1),
73
	cli(NULL),
74
	tbh(NULL) {
75
	//
76
}
77
78
TQStyleOption::TQStyleOption(int in1) :
79
	def(FALSE),
80
	tb(NULL),
81
	i1(in1),
82
	i2(-1),
83
	i3(-1),
84
	i4(-1),
85
	i5(-1),
86
	cli(NULL),
87
	tbh(NULL) {
88
	//
89
}
90
91
TQStyleOption::TQStyleOption(int in1, int in2) :
92
	def(FALSE),
93
	tb(NULL),
94
	i1(in1),
95
	i2(in2),
96
	i3(-1),
97
	i4(-1),
98
	i5(-1),
99
	cli(NULL),
100
	tbh(NULL) {
101
	//
102
}
103
104
TQStyleOption::TQStyleOption(int in1, int in2, int in3, int in4) :
105
	def(FALSE),
106
	tb(NULL),
107
	i1(in1),
108
	i2(in2),
109
	i3(in3),
110
	i4(in4),
111
	i5(-1),
112
	cli(NULL),
113
	tbh(NULL) {
114
	//
115
}
116
117
TQStyleOption::TQStyleOption(TQMenuItem* m) :
118
	def(FALSE),
119
	mi(m),
120
	tb(NULL),
121
	i1(-1),
122
	i2(-1),
123
	i3(-1),
124
	i4(-1),
125
	i5(-1),
126
	cli(NULL),
127
	tbh(NULL) {
128
	//
129
}
130
131
TQStyleOption::TQStyleOption(TQMenuItem* m, int in1) :
132
	def(FALSE),
133
	mi(m),
134
	tb(NULL),
135
	i1(in1),
136
	i2(-1),
137
	i3(-1),
138
	i4(-1),
139
	i5(-1),
140
	cli(NULL),
141
	tbh(NULL) {
142
	//
143
}
144
145
TQStyleOption::TQStyleOption(TQMenuItem* m, int in1, int in2) :
146
	def(FALSE),
147
	mi(m),
148
	tb(NULL),
149
	i1(in1),
150
	i2(in2),
151
	i3(-1),
152
	i4(-1),
153
	i5(-1),
154
	cli(NULL),
155
	tbh(NULL) {
156
	//
157
}
158
159
TQStyleOption::TQStyleOption(const TQColor& c) :
160
	def(FALSE),
161
	tb(NULL),
162
	cl(&c),
163
	i1(-1),
164
	i2(-1),
165
	i3(-1),
166
	i4(-1),
167
	i5(-1),
168
	cli(NULL),
169
	tbh(NULL) {
170
	//
171
}
172
173
TQStyleOption::TQStyleOption(TQTab* t) :
174
	def(FALSE),
175
	tb(t),
176
	i1(-1),
177
	i2(-1),
178
	i3(-1),
179
	i4(-1),
180
	i5(-1),
181
	cli(NULL),
182
	tbh(NULL) {
183
	//
184
}
185
186
TQStyleOption::TQStyleOption(TQListViewItem* i) :
187
	def(FALSE),
188
	tb(NULL),
189
	li(i),
190
	i1(-1),
191
	i2(-1),
192
	i3(-1),
193
	i4(-1),
194
	i5(-1),
195
	cli(NULL),
196
	tbh(NULL) {
197
	//
198
}
199
200
TQStyleOption::TQStyleOption(TQCheckListItem* i) :
201
	def(FALSE),
202
	tb(NULL),
203
	i1(-1),
204
	i2(-1),
205
	i3(-1),
206
	i4(-1),
207
	i5(-1),
208
	cli(i),
209
	tbh(NULL) {
210
	//
211
}
212
213
TQStyleOption::TQStyleOption(TQt::ArrowType a) :
214
	def(FALSE),
215
	tb(NULL),
216
	i1((int)a),
217
	i2(-1),
218
	i3(-1),
219
	i4(-1),
220
	i5(-1),
221
	cli(NULL),
222
	tbh(NULL) {
223
	//
224
}
225
226
TQStyleOption::TQStyleOption(const TQRect& r) :
227
	def(FALSE),
228
	tb(NULL),
229
	i1(r.x()),
230
	i2(r.y()),
231
	i3(r.width()),
232
	i4(r.height()),
233
	i5(-1),
234
	cli(NULL),
235
	tbh(NULL) {
236
	//
237
}
238
239
TQStyleOption::TQStyleOption(TQWidget *w) :
240
	def(FALSE),
241
	tb(NULL),
242
	i1(-1),
243
	i2(-1),
244
	i3(-1),
245
	i4(-1),
246
	i5(-1),
247
	cli(NULL),
248
	p1((void*)w),
249
	tbh(NULL) {
250
	//
251
}
252
65
/*!
253
/*!
66
    \class TQStyleOption ntqstyle.h
254
    \class TQStyleOption ntqstyle.h
67
    \brief The TQStyleOption class specifies optional parameters for TQStyle functions.
255
    \brief The TQStyleOption class specifies optional parameters for TQStyle functions.
(-)a/src/kernel/qthread.cpp (+4 lines)
Lines 132-137 Link Here
132
132
133
TQThread::TQThread()
133
TQThread::TQThread()
134
{
134
{
135
#ifdef QT_THREAD_SUPPORT
136
    TQMutexLocker locker( TQApplication::tqt_mutex );
137
#endif // QT_THREAD_SUPPORT
138
135
    d = new TQThreadInstance;
139
    d = new TQThreadInstance;
136
    d->init(0);
140
    d->init(0);
137
}
141
}
(-)a/src/kernel/qthread_unix.cpp (-2 / +3 lines)
Lines 398-403 void TQThread::start(Priority priority) Link Here
398
    d->args[0] = this;
398
    d->args[0] = this;
399
    d->args[1] = d;
399
    d->args[1] = d;
400
#if defined(QT_USE_GLIBMAINLOOP)
400
#if defined(QT_USE_GLIBMAINLOOP)
401
    // The correct thread_id is set in TQThreadInstance::start using the value of d->args[1]
402
    d->thread_id = NULL;
403
401
    // Legacy glib versions require this threading system initialization call
404
    // Legacy glib versions require this threading system initialization call
402
    g_thread_init(NULL);
405
    g_thread_init(NULL);
403
406
Lines 408-415 void TQThread::start(Priority priority) Link Here
408
    else {
411
    else {
409
	ret = -1;
412
	ret = -1;
410
    }
413
    }
411
    // The correct thread_id is set in TQThreadInstance::start using the value of d->args[1]
412
    d->thread_id = NULL;
413
#else // QT_USE_GLIBMAINLOOP
414
#else // QT_USE_GLIBMAINLOOP
414
    ret = pthread_create( &d->thread_id, &attr, (TQtThreadCallback)TQThreadInstance::start, d->args );
415
    ret = pthread_create( &d->thread_id, &attr, (TQtThreadCallback)TQThreadInstance::start, d->args );
415
#if defined (Q_OS_HPUX)
416
#if defined (Q_OS_HPUX)
(-)a/src/moc/moc.y (-1 / +4 lines)
Lines 2986-2992 void generateClass() // generate C++ source code for a class Link Here
2986
// Generate staticMetaObject member function
2986
// Generate staticMetaObject member function
2987
//
2987
//
2988
    fprintf( out, "TQMetaObject* %s::staticMetaObject()\n{\n", (const char*)qualifiedClassName() );
2988
    fprintf( out, "TQMetaObject* %s::staticMetaObject()\n{\n", (const char*)qualifiedClassName() );
2989
    fprintf( out, "    if ( metaObj )\n\treturn metaObj;\n" );
2989
    fprintf( out, "    if ( metaObj ) {\n\treturn metaObj;\n}\n" );
2990
    fprintf( out, "#ifdef QT_THREAD_SUPPORT\n    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->lock();\n" );
2991
    fprintf( out, "    if ( metaObj ) {\n\tif (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();\n\treturn metaObj;\n    }\n#endif // QT_THREAD_SUPPORT\n" );
2990
    if ( isTQObject )
2992
    if ( isTQObject )
2991
	fprintf( out, "    TQMetaObject* parentObject = staticTQtMetaObject();\n" );
2993
	fprintf( out, "    TQMetaObject* parentObject = staticTQtMetaObject();\n" );
2992
    else if ( !g->superClassName.isEmpty() )
2994
    else if ( !g->superClassName.isEmpty() )
Lines 3056-3061 void generateClass() // generate C++ source code for a class Link Here
3056
// Setup cleanup handler and return meta object
3058
// Setup cleanup handler and return meta object
3057
//
3059
//
3058
    fprintf( out, "    cleanUp_%s.setMetaObject( metaObj );\n", cleanup.data() );
3060
    fprintf( out, "    cleanUp_%s.setMetaObject( metaObj );\n", cleanup.data() );
3061
    fprintf( out, "#ifdef QT_THREAD_SUPPORT\n    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();\n#endif // QT_THREAD_SUPPORT\n" );
3059
    fprintf( out, "    return metaObj;\n}\n" );
3062
    fprintf( out, "    return metaObj;\n}\n" );
3060
3063
3061
//
3064
//
(-)a/src/moc/moc_yacc.cpp (-1 / +4 lines)
Lines 5812-5818 void generateClass() // generate C++ source code for a class Link Here
5812
// Generate staticMetaObject member function
5812
// Generate staticMetaObject member function
5813
//
5813
//
5814
    fprintf( out, "TQMetaObject* %s::staticMetaObject()\n{\n", (const char*)qualifiedClassName() );
5814
    fprintf( out, "TQMetaObject* %s::staticMetaObject()\n{\n", (const char*)qualifiedClassName() );
5815
    fprintf( out, "    if ( metaObj )\n\treturn metaObj;\n" );
5815
    fprintf( out, "    if ( metaObj ) {\n\treturn metaObj;\n}\n" );
5816
    fprintf( out, "#ifdef QT_THREAD_SUPPORT\n    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->lock();\n" );
5817
    fprintf( out, "    if ( metaObj ) {\n\tif (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();\n\treturn metaObj;\n    }\n#endif // QT_THREAD_SUPPORT\n" );
5816
    if ( isTQObject )
5818
    if ( isTQObject )
5817
	fprintf( out, "    TQMetaObject* parentObject = staticTQtMetaObject();\n" );
5819
	fprintf( out, "    TQMetaObject* parentObject = staticTQtMetaObject();\n" );
5818
    else if ( !g->superClassName.isEmpty() )
5820
    else if ( !g->superClassName.isEmpty() )
Lines 5882-5887 void generateClass() // generate C++ source code for a class Link Here
5882
// Setup cleanup handler and return meta object
5884
// Setup cleanup handler and return meta object
5883
//
5885
//
5884
    fprintf( out, "    cleanUp_%s.setMetaObject( metaObj );\n", cleanup.data() );
5886
    fprintf( out, "    cleanUp_%s.setMetaObject( metaObj );\n", cleanup.data() );
5887
    fprintf( out, "#ifdef QT_THREAD_SUPPORT\n    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();\n#endif // QT_THREAD_SUPPORT\n" );
5885
    fprintf( out, "    return metaObj;\n}\n" );
5888
    fprintf( out, "    return metaObj;\n}\n" );
5886
5889
5887
//
5890
//
(-)a/src/styles/qcommonstyle.cpp (-3 / +10 lines)
Lines 42-47 Link Here
42
42
43
#ifndef QT_NO_STYLE
43
#ifndef QT_NO_STYLE
44
44
45
#include "ntqmutex.h"
45
#include "ntqmenubar.h"
46
#include "ntqmenubar.h"
46
#include "ntqapplication.h"
47
#include "ntqapplication.h"
47
#include "ntqpainter.h"
48
#include "ntqpainter.h"
Lines 2782-2787 int TQCommonStyle::pixelMetric(PixelMetric m, const TQStyleControlElementData &c Link Here
2782
		ret = TQMAX( TQFontMetrics(ceData.font).lineSpacing(), 18 );
2783
		ret = TQMAX( TQFontMetrics(ceData.font).lineSpacing(), 18 );
2783
	    }
2784
	    }
2784
	}
2785
	}
2786
	else {
2787
		ret = 0;
2788
	}
2785
	break; }
2789
	break; }
2786
    case PM_ScrollBarSliderMin:
2790
    case PM_ScrollBarSliderMin:
2787
	ret = 9;
2791
	ret = 9;
Lines 2853-2864 int TQCommonStyle::pixelMetric(PixelMetric m, const TQStyleControlElementData &c Link Here
2853
	    int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget );
2857
	    int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget );
2854
	    int ticks = ceData.tickMarkSetting;
2858
	    int ticks = ceData.tickMarkSetting;
2855
2859
2856
	    if ( ticks == TQSlider::Both )
2860
	    if ( ticks == TQSlider::Both ) {
2857
		ret = (space - thickness) / 2;
2861
		ret = (space - thickness) / 2;
2858
	    else if ( ticks == TQSlider::Above )
2862
	    }
2863
	    else if ( ticks == TQSlider::Above ) {
2859
		ret = space - thickness;
2864
		ret = space - thickness;
2860
	    else
2865
	    }
2866
	    else {
2861
		ret = 0;
2867
		ret = 0;
2868
	    }
2862
	    break;
2869
	    break;
2863
	}
2870
	}
2864
2871
(-)a/src/tools/ntqshared.h (-1 lines)
Lines 45-51 Link Here
45
#include "ntqglobal.h"
45
#include "ntqglobal.h"
46
#endif // QT_H
46
#endif // QT_H
47
47
48
49
struct Q_EXPORT TQShared
48
struct Q_EXPORT TQShared
50
{
49
{
51
    TQShared() : count( 1 ) { }
50
    TQShared() : count( 1 ) { }
(-)a/src/tools/ntqstring.h (-38 / +8 lines)
Lines 71-76 Link Here
71
class TQRegExp;
71
class TQRegExp;
72
class TQString;
72
class TQString;
73
class TQCharRef;
73
class TQCharRef;
74
class TQMutex;
74
template <class T> class TQDeepCopy;
75
template <class T> class TQDeepCopy;
75
76
76
class Q_EXPORT TQChar {
77
class Q_EXPORT TQChar {
Lines 359-380 inline bool operator>( TQChar c1, TQChar c2 ) { return !(c2>=c1); } Link Here
359
360
360
// internal
361
// internal
361
struct Q_EXPORT TQStringData : public TQShared {
362
struct Q_EXPORT TQStringData : public TQShared {
362
    TQStringData() :
363
    TQStringData();
363
        TQShared(), unicode(0), ascii(0), len(0), issimpletext(TRUE), maxl(0), islatin1(FALSE), security_unpaged(FALSE) { ref(); }
364
    TQStringData(TQChar *u, uint l, uint m);
364
    TQStringData(TQChar *u, uint l, uint m) :
365
        TQShared(), unicode(u), ascii(0), len(l), issimpletext(FALSE), maxl(m), islatin1(FALSE), security_unpaged(FALSE) { }
366
    ~TQStringData();
365
    ~TQStringData();
367
366
368
    void deleteSelf();
367
    void deleteSelf();
369
    TQChar *unicode;
368
    TQChar *unicode;
370
    char *ascii;
369
    char *ascii;
371
    void setDirty() {
370
    void setDirty();
372
	if ( ascii ) {
373
	    delete [] ascii;
374
	    ascii = 0;
375
	}
376
	issimpletext = FALSE;
377
    }
378
#ifdef Q_OS_MAC9
371
#ifdef Q_OS_MAC9
379
    uint len;
372
    uint len;
380
#else
373
#else
Lines 390-395 struct Q_EXPORT TQStringData : public TQShared { Link Here
390
383
391
    bool security_unpaged : 1;
384
    bool security_unpaged : 1;
392
385
386
    TQMutex* mutex;
387
393
private:
388
private:
394
#if defined(TQ_DISABLE_COPY)
389
#if defined(TQ_DISABLE_COPY)
395
    TQStringData( const TQStringData& );
390
    TQStringData( const TQStringData& );
Lines 646-658 public: Link Here
646
641
647
    TQChar constref(uint i) const
642
    TQChar constref(uint i) const
648
        { return at(i); }
643
        { return at(i); }
649
    TQChar& ref(uint i)
644
    TQChar& ref(uint i);
650
        { // Optimized for easy-inlining by simple compilers.
651
            if ( d->count != 1 || i >= d->len )
652
                subat( i );
653
            d->setDirty();
654
            return d->unicode[i];
655
        }
656
645
657
    const TQChar* unicode() const { return d->unicode; }
646
    const TQChar* unicode() const { return d->unicode; }
658
    const char* ascii() const;
647
    const char* ascii() const;
Lines 747-753 private: Link Here
747
736
748
    friend class TQConstString;
737
    friend class TQConstString;
749
    friend class TQTextStream;
738
    friend class TQTextStream;
750
    TQString( TQStringData* dd, bool /* dummy */ ) : d(dd) { }
739
    TQString( TQStringData* dd, bool /* dummy */ );
751
740
752
    // needed for TQDeepCopy
741
    // needed for TQDeepCopy
753
    void detach();
742
    void detach();
Lines 839-863 Q_EXPORT TQDataStream &operator>>( TQDataStream &, TQString & ); Link Here
839
  TQString inline functions
828
  TQString inline functions
840
 *****************************************************************************/
829
 *****************************************************************************/
841
830
842
// These two move code into makeSharedNull() and deletesData()
843
// to improve cache-coherence (and reduce code bloat), while
844
// keeping the common cases fast.
845
//
846
// No safe way to pre-init shared_null on ALL compilers/linkers.
847
inline TQString::TQString() :
848
    d(shared_null ? shared_null : makeSharedNull())
849
{
850
    d->ref();
851
}
852
//
853
inline TQString::~TQString()
854
{
855
    if ( d->deref() ) {
856
        if ( d != shared_null )
857
	    d->deleteSelf();
858
    }
859
}
860
861
// needed for TQDeepCopy
831
// needed for TQDeepCopy
862
inline void TQString::detach()
832
inline void TQString::detach()
863
{ real_detach(); }
833
{ real_detach(); }
(-)a/src/tools/qstring.cpp (-46 / +283 lines)
Lines 87-92 Link Here
87
#define ULLONG_MAX TQ_UINT64_C(18446744073709551615)
87
#define ULLONG_MAX TQ_UINT64_C(18446744073709551615)
88
#endif
88
#endif
89
89
90
#ifdef QT_THREAD_SUPPORT
91
#include "ntqmutex.h"
92
#endif // QT_THREAD_SUPPORT
93
94
extern TQMutex *tqt_sharedStringMutex;
95
90
static int ucstrcmp( const TQString &as, const TQString &bs )
96
static int ucstrcmp( const TQString &as, const TQString &bs )
91
{
97
{
92
    const TQChar *a = as.unicode();
98
    const TQChar *a = as.unicode();
Lines 1033-1044 static inline bool format(TQChar::Decomposition tag, TQString & str, Link Here
1033
} // format()
1039
} // format()
1034
#endif
1040
#endif
1035
1041
1042
TQStringData::TQStringData() : TQShared(),
1043
	unicode(0),
1044
	ascii(0),
1045
	len(0),
1046
	issimpletext(TRUE),
1047
	maxl(0),
1048
	islatin1(FALSE),
1049
	security_unpaged(FALSE) {
1050
#ifdef QT_THREAD_SUPPORT
1051
	mutex = new TQMutex( TRUE );
1052
	mutex->lock();
1053
#endif // QT_THREAD_SUPPORT
1054
	ref();
1055
#ifdef QT_THREAD_SUPPORT
1056
	mutex->unlock();
1057
#endif // QT_THREAD_SUPPORT
1058
}
1059
1060
TQStringData::TQStringData(TQChar *u, uint l, uint m) : TQShared(),
1061
	unicode(u),
1062
	ascii(0),
1063
	len(l),
1064
	issimpletext(FALSE),
1065
	maxl(m),
1066
	islatin1(FALSE),
1067
	security_unpaged(FALSE) {
1068
#ifdef QT_THREAD_SUPPORT
1069
	mutex = new TQMutex( TRUE );
1070
#endif // QT_THREAD_SUPPORT
1071
}
1072
1036
TQStringData::~TQStringData() {
1073
TQStringData::~TQStringData() {
1037
    if ( unicode ) delete[] ((char*)unicode);
1074
	if ( unicode ) delete[] ((char*)unicode);
1038
    if ( ascii && security_unpaged ) {
1075
	if ( ascii && security_unpaged ) {
1039
	munlock(ascii, LINUX_MEMLOCK_LIMIT_BYTES);
1076
		munlock(ascii, LINUX_MEMLOCK_LIMIT_BYTES);
1040
    }
1077
	}
1041
    if ( ascii ) delete[] ascii;
1078
	if ( ascii ) delete[] ascii;
1079
#ifdef QT_THREAD_SUPPORT
1080
	if ( mutex ) delete mutex;
1081
#endif // QT_THREAD_SUPPORT
1082
}
1083
1084
void TQStringData::setDirty() {
1085
	if ( ascii ) {
1086
		delete [] ascii;
1087
		ascii = 0;
1088
	}
1089
	issimpletext = FALSE;
1042
}
1090
}
1043
1091
1044
/*
1092
/*
Lines 1194-1220 TQChar* TQString::latin1ToUnicode( const char *str, uint* len, uint maxlen ) Link Here
1194
    return result;
1242
    return result;
1195
}
1243
}
1196
1244
1197
static TQChar* internalLatin1ToUnicode( const char *str, uint* len,
1245
static TQChar* internalLatin1ToUnicode( const char *str, uint* len, uint maxlen = (uint)-1 )
1198
				      uint maxlen = (uint)-1 )
1199
{
1246
{
1200
    TQChar* result = 0;
1247
    TQChar* result = 0;
1201
    uint l = 0;
1248
    uint l = 0;
1202
    if ( str ) {
1249
    if ( str ) {
1203
	if ( maxlen != (uint)-1 ) {
1250
	if ( maxlen != (uint)-1 ) {
1204
	    while ( l < maxlen && str[l] )
1251
	    while ( l < maxlen && str[l] ) {
1205
		l++;
1252
		l++;
1206
	} else {
1253
	    }
1254
	}
1255
	else {
1207
	    // Faster?
1256
	    // Faster?
1208
	    l = int(strlen( str ));
1257
	    l = int(strlen( str ));
1209
	}
1258
	}
1210
	TQChar *uc = QT_ALLOC_QCHAR_VEC( l );
1259
	TQChar *uc = QT_ALLOC_QCHAR_VEC( l );
1211
	result = uc;
1260
	result = uc;
1212
	uint i = l;
1261
	uint i = l;
1213
	while ( i-- )
1262
	while ( i-- ) {
1214
	    *uc++ = *str++;
1263
	    *uc++ = *str++;
1264
	}
1215
    }
1265
    }
1216
    if ( len )
1266
    if ( len ) {
1217
	*len = l;
1267
	*len = l;
1268
    }
1218
    return result;
1269
    return result;
1219
}
1270
}
1220
1271
Lines 1395-1405 QT_STATIC_CONST_IMPL TQChar TQChar::nbsp((ushort)0x00a0); Link Here
1395
1446
1396
TQStringData* TQString::makeSharedNull()
1447
TQStringData* TQString::makeSharedNull()
1397
{
1448
{
1449
#ifdef QT_THREAD_SUPPORT
1450
    if (tqt_sharedStringMutex) tqt_sharedStringMutex->lock();
1451
#endif // QT_THREAD_SUPPORT
1452
1453
    if (TQString::shared_null) {
1454
#ifdef QT_THREAD_SUPPORT
1455
	if (tqt_sharedStringMutex) tqt_sharedStringMutex->unlock();
1456
#endif // QT_THREAD_SUPPORT
1457
	return TQString::shared_null;
1458
    }
1459
1398
    TQString::shared_null = new TQStringData;
1460
    TQString::shared_null = new TQStringData;
1399
#if defined( Q_OS_MAC ) || defined(Q_OS_SOLARIS) || defined(Q_OS_HPUX) || defined(Q_OS_AIX)
1461
#if defined( Q_OS_MAC ) || defined(Q_OS_SOLARIS) || defined(Q_OS_HPUX) || defined(Q_OS_AIX)
1400
    TQString *that = const_cast<TQString *>(&TQString::null);
1462
    TQString *that = const_cast<TQString *>(&TQString::null);
1401
    that->d = TQString::shared_null;
1463
    that->d = TQString::shared_null;
1402
#endif
1464
#endif
1465
1466
#ifdef QT_THREAD_SUPPORT
1467
    if (tqt_sharedStringMutex) tqt_sharedStringMutex->unlock();
1468
#endif // QT_THREAD_SUPPORT
1403
    return TQString::shared_null;
1469
    return TQString::shared_null;
1404
}
1470
}
1405
1471
Lines 1412-1417 TQStringData* TQString::makeSharedNull() Link Here
1412
    \sa isNull()
1478
    \sa isNull()
1413
*/
1479
*/
1414
1480
1481
// FIXME
1482
// Original Qt3 code stated that there is
1483
// "No safe way to pre-init shared_null on ALL compilers/linkers"
1484
// Is this still true?
1485
1486
TQString::TQString() :
1487
    d(0)
1488
{
1489
	d = shared_null ? shared_null : makeSharedNull();
1490
#ifdef QT_THREAD_SUPPORT
1491
	d->mutex->lock();
1492
#endif // QT_THREAD_SUPPORT
1493
	d->ref();
1494
#ifdef QT_THREAD_SUPPORT
1495
	d->mutex->unlock();
1496
#endif // QT_THREAD_SUPPORT
1497
}
1498
1415
/*!
1499
/*!
1416
    Constructs a string of length one, containing the character \a ch.
1500
    Constructs a string of length one, containing the character \a ch.
1417
*/
1501
*/
Lines 1428-1434 TQString::TQString( TQChar ch ) Link Here
1428
TQString::TQString( const TQString &s ) :
1512
TQString::TQString( const TQString &s ) :
1429
    d(s.d)
1513
    d(s.d)
1430
{
1514
{
1515
#ifdef QT_THREAD_SUPPORT
1516
    d->mutex->lock();
1517
#endif // QT_THREAD_SUPPORT
1518
1431
    d->ref();
1519
    d->ref();
1520
1521
#ifdef QT_THREAD_SUPPORT
1522
    d->mutex->unlock();
1523
#endif // QT_THREAD_SUPPORT
1432
}
1524
}
1433
1525
1434
/*!
1526
/*!
Lines 1451-1457 TQString::TQString( int size, bool /*dummy*/ ) Link Here
1451
	d = new TQStringData( uc, 0, l );
1543
	d = new TQStringData( uc, 0, l );
1452
    } else {
1544
    } else {
1453
	d = shared_null ? shared_null : (shared_null=new TQStringData);
1545
	d = shared_null ? shared_null : (shared_null=new TQStringData);
1546
#ifdef QT_THREAD_SUPPORT
1547
	d->mutex->lock();
1548
#endif // QT_THREAD_SUPPORT
1454
	d->ref();
1549
	d->ref();
1550
#ifdef QT_THREAD_SUPPORT
1551
	d->mutex->unlock();
1552
#endif // QT_THREAD_SUPPORT
1455
    }
1553
    }
1456
}
1554
}
1457
1555
Lines 1493-1503 TQString::TQString( const TQChar* unicode, uint length ) Link Here
1493
{
1591
{
1494
    if ( !unicode && !length ) {
1592
    if ( !unicode && !length ) {
1495
	d = shared_null ? shared_null : makeSharedNull();
1593
	d = shared_null ? shared_null : makeSharedNull();
1594
#ifdef QT_THREAD_SUPPORT
1595
	d->mutex->lock();
1596
#endif // QT_THREAD_SUPPORT
1496
	d->ref();
1597
	d->ref();
1497
    } else {
1598
#ifdef QT_THREAD_SUPPORT
1599
	d->mutex->unlock();
1600
#endif // QT_THREAD_SUPPORT
1601
    }
1602
    else {
1498
	TQChar* uc = QT_ALLOC_QCHAR_VEC( length );
1603
	TQChar* uc = QT_ALLOC_QCHAR_VEC( length );
1499
	if ( unicode )
1604
	if ( unicode ) {
1500
	    memcpy(uc, unicode, length*sizeof(TQChar));
1605
	    memcpy(uc, unicode, length*sizeof(TQChar));
1606
	}
1501
	d = new TQStringData(uc,unicode ? length : 0,length);
1607
	d = new TQStringData(uc,unicode ? length : 0,length);
1502
    }
1608
    }
1503
}
1609
}
Lines 1556-1561 TQString::TQString( const std::string &str ) Link Here
1556
}
1662
}
1557
#endif
1663
#endif
1558
1664
1665
TQString::TQString( TQStringData* dd, bool /* dummy */ ) {
1666
	d = dd;
1667
}
1668
1559
/*!
1669
/*!
1560
    \fn TQString::~TQString()
1670
    \fn TQString::~TQString()
1561
1671
Lines 1563-1568 TQString::TQString( const std::string &str ) Link Here
1563
    last reference to the string.
1673
    last reference to the string.
1564
*/
1674
*/
1565
1675
1676
TQString::~TQString()
1677
{
1678
#ifdef QT_THREAD_SUPPORT
1679
	d->mutex->lock();
1680
#endif // QT_THREAD_SUPPORT
1681
	if ( d->deref() ) {
1682
		if ( d != shared_null ) {
1683
#ifdef QT_THREAD_SUPPORT
1684
			d->mutex->unlock();
1685
#endif // QT_THREAD_SUPPORT
1686
			d->deleteSelf();
1687
		}
1688
		else {
1689
#ifdef QT_THREAD_SUPPORT
1690
			d->mutex->unlock();
1691
#endif // QT_THREAD_SUPPORT
1692
		}
1693
	}
1694
	else {
1695
#ifdef QT_THREAD_SUPPORT
1696
		d->mutex->unlock();
1697
#endif // QT_THREAD_SUPPORT
1698
	}
1699
}
1700
1566
1701
1567
/*!
1702
/*!
1568
    Deallocates any space reserved solely by this TQString.
1703
    Deallocates any space reserved solely by this TQString.
Lines 1580-1590 void TQString::real_detach() Link Here
1580
1715
1581
void TQString::deref()
1716
void TQString::deref()
1582
{
1717
{
1583
    if ( d && d->deref() ) {
1718
	if ( d ) {
1584
	if ( d != shared_null )
1719
#ifdef QT_THREAD_SUPPORT
1585
	    delete d;
1720
		d->mutex->lock();
1586
	d = 0;
1721
#endif // QT_THREAD_SUPPORT
1587
    }
1722
		if ( d->deref() ) {
1723
#ifdef QT_THREAD_SUPPORT
1724
			d->mutex->unlock();
1725
#endif // QT_THREAD_SUPPORT
1726
			if ( d != shared_null ) {
1727
				delete d;
1728
			}
1729
			d = 0;
1730
		}
1731
		else {
1732
#ifdef QT_THREAD_SUPPORT
1733
			d->mutex->unlock();
1734
#endif // QT_THREAD_SUPPORT
1735
		}
1736
	}
1588
}
1737
}
1589
1738
1590
void TQStringData::deleteSelf()
1739
void TQStringData::deleteSelf()
Lines 1624-1632 void TQStringData::deleteSelf() Link Here
1624
*/
1773
*/
1625
TQString &TQString::operator=( const TQString &s )
1774
TQString &TQString::operator=( const TQString &s )
1626
{
1775
{
1776
#ifdef QT_THREAD_SUPPORT
1777
    s.d->mutex->lock();
1778
#endif // QT_THREAD_SUPPORT
1627
    s.d->ref();
1779
    s.d->ref();
1780
#ifdef QT_THREAD_SUPPORT
1781
    s.d->mutex->unlock();
1782
#endif // QT_THREAD_SUPPORT
1628
    deref();
1783
    deref();
1629
    d = s.d;
1784
    d = s.d;
1785
1630
    return *this;
1786
    return *this;
1631
}
1787
}
1632
1788
Lines 1730-1735 void TQString::truncate( uint newLen ) Link Here
1730
*/
1886
*/
1731
void TQString::setLength( uint newLen )
1887
void TQString::setLength( uint newLen )
1732
{
1888
{
1889
#ifdef QT_THREAD_SUPPORT
1890
    d->mutex->lock();
1891
#endif // QT_THREAD_SUPPORT
1892
1733
    if ( d->count != 1 || newLen > d->maxl ||
1893
    if ( d->count != 1 || newLen > d->maxl ||
1734
	 ( newLen * 4 < d->maxl && d->maxl > 4 ) ) {
1894
	 ( newLen * 4 < d->maxl && d->maxl > 4 ) ) {
1735
	// detach, grow or shrink
1895
	// detach, grow or shrink
Lines 1739-1750 void TQString::setLength( uint newLen ) Link Here
1739
	    uint len = TQMIN( d->len, newLen );
1899
	    uint len = TQMIN( d->len, newLen );
1740
	    memcpy( nd, d->unicode, sizeof(TQChar) * len );
1900
	    memcpy( nd, d->unicode, sizeof(TQChar) * len );
1741
	    bool unpaged = d->security_unpaged;
1901
	    bool unpaged = d->security_unpaged;
1902
#ifdef QT_THREAD_SUPPORT
1903
	    d->mutex->unlock();
1904
#endif // QT_THREAD_SUPPORT
1742
	    deref();
1905
	    deref();
1743
	    d = new TQStringData( nd, newLen, newMax );
1906
	    d = new TQStringData( nd, newLen, newMax );
1744
	    setSecurityUnPaged(unpaged);
1907
	    setSecurityUnPaged(unpaged);
1745
	}
1908
	}
1746
    } else {
1909
	else {
1910
#ifdef QT_THREAD_SUPPORT
1911
	    d->mutex->unlock();
1912
#endif // QT_THREAD_SUPPORT
1913
	}
1914
    }
1915
    else {
1747
	d->len = newLen;
1916
	d->len = newLen;
1917
#ifdef QT_THREAD_SUPPORT
1918
	d->mutex->unlock();
1919
#endif // QT_THREAD_SUPPORT
1748
	d->setDirty();
1920
	d->setDirty();
1749
    }
1921
    }
1750
}
1922
}
Lines 1830-1839 void TQString::squeeze() Link Here
1830
*/
2002
*/
1831
void TQString::grow( uint newLen )
2003
void TQString::grow( uint newLen )
1832
{
2004
{
2005
#ifdef QT_THREAD_SUPPORT
2006
    d->mutex->lock();
2007
#endif // QT_THREAD_SUPPORT
2008
1833
    if ( d->count != 1 || newLen > d->maxl ) {
2009
    if ( d->count != 1 || newLen > d->maxl ) {
2010
#ifdef QT_THREAD_SUPPORT
2011
	d->mutex->unlock();
2012
#endif // QT_THREAD_SUPPORT
1834
	setLength( newLen );
2013
	setLength( newLen );
1835
    } else {
2014
    }
2015
    else {
1836
	d->len = newLen;
2016
	d->len = newLen;
2017
#ifdef QT_THREAD_SUPPORT
2018
	d->mutex->unlock();
2019
#endif // QT_THREAD_SUPPORT
1837
	d->setDirty();
2020
	d->setDirty();
1838
    }
2021
    }
1839
}
2022
}
Lines 5868-5880 static TQChar *addOne(TQChar *qch, TQString &str) Link Here
5868
*/
6051
*/
5869
TQString TQString::fromUtf8( const char* utf8, int len )
6052
TQString TQString::fromUtf8( const char* utf8, int len )
5870
{
6053
{
5871
    if ( !utf8 )
6054
    if ( !utf8 ) {
5872
	return TQString::null;
6055
	return TQString::null;
6056
    }
5873
6057
5874
    int slen = 0;
6058
    int slen = 0;
5875
    if (len >= 0) {
6059
    if (len >= 0) {
5876
	while (slen < len && utf8[slen])
6060
	while (slen < len && utf8[slen]) {
5877
		slen++;
6061
		slen++;
6062
	}
5878
    } else {
6063
    } else {
5879
        slen = int(strlen(utf8));
6064
        slen = int(strlen(utf8));
5880
    }
6065
    }
Lines 6012-6021 TQString TQString::fromLatin1( const char* chars, int len ) Link Here
6012
{
6197
{
6013
    uint l;
6198
    uint l;
6014
    TQChar *uc;
6199
    TQChar *uc;
6015
    if ( len < 0 )
6200
    if ( len < 0 ) {
6016
	 len = -1;
6201
	 len = -1;
6202
    }
6017
    uc = internalLatin1ToUnicode( chars, &l, len );
6203
    uc = internalLatin1ToUnicode( chars, &l, len );
6018
    return TQString( new TQStringData(uc, l, l), TRUE );
6204
    TQString ret( new TQStringData(uc, l, l), TRUE );
6205
6206
    return ret;
6019
}
6207
}
6020
6208
6021
/*!
6209
/*!
Lines 6178-6184 TQString TQString::fromUcs2( const unsigned short *str ) Link Here
6178
	    length++;
6366
	    length++;
6179
	TQChar* uc = QT_ALLOC_QCHAR_VEC( length );
6367
	TQChar* uc = QT_ALLOC_QCHAR_VEC( length );
6180
	memcpy( uc, str, length*sizeof(TQChar) );
6368
	memcpy( uc, str, length*sizeof(TQChar) );
6181
	return TQString( new TQStringData( uc, length, length ), TRUE );
6369
	TQString ret( new TQStringData( uc, length, length ), TRUE );
6370
	return ret;
6182
    }
6371
    }
6183
}
6372
}
6184
6373
Lines 6225-6230 TQString TQString::fromUcs2( const unsigned short *str ) Link Here
6225
    \sa constref()
6414
    \sa constref()
6226
*/
6415
*/
6227
6416
6417
TQChar& TQString::ref(uint i) {
6418
#ifdef QT_THREAD_SUPPORT
6419
	d->mutex->lock();
6420
#endif // QT_THREAD_SUPPORT
6421
	if ( (d->count != 1) || (i >= d->len) ) {
6422
#ifdef QT_THREAD_SUPPORT
6423
		d->mutex->unlock();
6424
#endif // QT_THREAD_SUPPORT
6425
		subat( i );
6426
	}
6427
	else {
6428
#ifdef QT_THREAD_SUPPORT
6429
		d->mutex->unlock();
6430
#endif // QT_THREAD_SUPPORT
6431
	}
6432
	d->setDirty();
6433
	return d->unicode[i];
6434
}
6435
6228
/*!
6436
/*!
6229
    \fn TQChar TQString::operator[]( int ) const
6437
    \fn TQChar TQString::operator[]( int ) const
6230
6438
Lines 6300-6326 void TQString::subat( uint i ) Link Here
6300
6508
6301
TQString& TQString::setUnicode( const TQChar *unicode, uint len )
6509
TQString& TQString::setUnicode( const TQChar *unicode, uint len )
6302
{
6510
{
6303
    if ( len == 0 ) {                           // set to null string
6511
	if ( len == 0 ) {                       // set to null string
6304
	if ( d != shared_null ) {               // beware of nullstring being set to nullstring
6512
		if ( d != shared_null ) {       // beware of nullstring being set to nullstring
6305
	    deref();
6513
			deref();
6306
	    d = shared_null ? shared_null : makeSharedNull();
6514
			d = shared_null ? shared_null : makeSharedNull();
6307
	    d->ref();
6515
#ifdef QT_THREAD_SUPPORT
6516
			d->mutex->lock();
6517
#endif // QT_THREAD_SUPPORT
6518
			d->ref();
6519
#ifdef QT_THREAD_SUPPORT
6520
			d->mutex->unlock();
6521
#endif // QT_THREAD_SUPPORT
6522
		}
6308
	}
6523
	}
6309
    } else if ( d->count != 1 || len > d->maxl ||
6524
	else {
6310
		( len * 4 < d->maxl && d->maxl > 4 ) ) {
6525
#ifdef QT_THREAD_SUPPORT
6311
	// detach, grown or shrink
6526
		d->mutex->lock();
6312
	uint newMax = computeNewMax( len );
6527
#endif // QT_THREAD_SUPPORT
6313
	TQChar* nd = QT_ALLOC_QCHAR_VEC( newMax );
6528
		if ( d->count != 1 || len > d->maxl || ( len * 4 < d->maxl && d->maxl > 4 ) ) {
6314
	if ( unicode )
6529
			// detach, grown or shrink
6315
	    memcpy( nd, unicode, sizeof(TQChar)*len );
6530
			uint newMax = computeNewMax( len );
6316
	deref();
6531
			TQChar* nd = QT_ALLOC_QCHAR_VEC( newMax );
6317
	d = new TQStringData( nd, len, newMax );
6532
			if ( unicode ) {
6318
    } else {
6533
				memcpy( nd, unicode, sizeof(TQChar)*len );
6319
	d->len = len;
6534
			}
6320
	d->setDirty();
6535
#ifdef QT_THREAD_SUPPORT
6321
	if ( unicode )
6536
			d->mutex->unlock();
6322
	    memcpy( d->unicode, unicode, sizeof(TQChar)*len );
6537
#endif // QT_THREAD_SUPPORT
6323
    }
6538
			deref();
6539
			d = new TQStringData( nd, len, newMax );
6540
		}
6541
		else {
6542
			d->len = len;
6543
#ifdef QT_THREAD_SUPPORT
6544
			d->mutex->unlock();
6545
#endif // QT_THREAD_SUPPORT
6546
			d->setDirty();
6547
			if ( unicode ) {
6548
				memcpy( d->unicode, unicode, sizeof(TQChar)*len );
6549
			}
6550
		}
6551
	}
6552
6324
    return *this;
6553
    return *this;
6325
}
6554
}
6326
6555
Lines 7024-7038 TQConstString::TQConstString( const TQChar* unicode, uint length ) : Link Here
7024
*/
7253
*/
7025
TQConstString::~TQConstString()
7254
TQConstString::~TQConstString()
7026
{
7255
{
7256
#ifdef QT_THREAD_SUPPORT
7257
    d->mutex->lock();
7258
#endif // QT_THREAD_SUPPORT
7259
7027
    if ( d->count > 1 ) {
7260
    if ( d->count > 1 ) {
7028
	TQChar* cp = QT_ALLOC_QCHAR_VEC( d->len );
7261
	TQChar* cp = QT_ALLOC_QCHAR_VEC( d->len );
7029
	memcpy( cp, d->unicode, d->len*sizeof(TQChar) );
7262
	memcpy( cp, d->unicode, d->len*sizeof(TQChar) );
7030
	d->unicode = cp;
7263
	d->unicode = cp;
7031
    } else {
7264
    }
7265
    else {
7032
	d->unicode = 0;
7266
	d->unicode = 0;
7033
    }
7267
    }
7034
7268
7035
    // The original d->unicode is now unlinked.
7269
    // The original d->unicode is now unlinked.
7270
#ifdef QT_THREAD_SUPPORT
7271
    d->mutex->unlock();
7272
#endif // QT_THREAD_SUPPORT
7036
}
7273
}
7037
7274
7038
/*!
7275
/*!

Return to bug 1508