serialization: Mark util as public dependency

referencecounting.h exposes util/spinlock.h
Reintroduce kdewin compatibility library.

We'll get rid of it when we port the code away from Unixisms.
Kill util/spinlock.h, it is actually worse than QMutex in every case

QMutex has changed a lot since this code was introduced and now has the
same kind of logic as SpinLock internally, but implements it a lot more
efficiently. Instead of requiring a QMutex::lock() call and a call to
QWaitCondition::wait() (which is two more compare-and-swap instructions)
it directly uses the futex() syscall.

There are also a few problems with the spinlock code:

- It spins using testAndSetOrdered() instead of testAndSetRelaxed().

- There is also no need to unlock using sequentially consistent order,
storeRelease() is enough.

- Even worse is the fact that it uses compare-and-swap
(QAtomicInt::testAndSet*()) for the spinlock, instead of test-and-set
(QAtomicInt::fetchAndStore*()) which would be a lot faster.

- For handling locking with timeout Spinlock uses gettimeofday() which
is not available on e.g. Windows.

- Finally, the class is poorly named, it isn't a spinlock since it
sleeps in every loop iteration instead of continuously attempting to
acquire the lock.

A class that actually tries spinning on the lock for a few iterations
before taking the slow path that sleeps MIGHT improve the throughput.
However, finding the right count is hard and will decrease performance
if not chosen correctly.

The easiest way to gain a bit of performance in the locking code would
be to use QBasicMutex for all non-recursive QMutexes, since that would
allow inlining of the fast path lock() code. But since the class is not
documented as public we should probably not do that.

REVIEW: 121570
convert all connections to QDialogButtonBox to new signal slot syntax
don't connect to same slot twice (was probably a merge error)
quickopen: Fix rare crash

Access on half-destructed QuickOpenWidget*. See comment in source code
for further explanation.

Backtrace:
0  0x00007ffff592dc56 in
QBasicAtomicPointer<QAbstractEventDispatcher>::load (this=0x40) at
../../include/QtCore/../../../../../src/qt5/qtbase/src/corelib/thread/qbasicatomic.h:246
1  0x00007ffff5c08005 in QObject::startTimer (this=0x294c2d8,
interval=0, timerType=Qt::CoarseTimer) at
/home/krf/devel/src/qt5/qtbase/src/corelib/kernel/qobject.cpp:1618
2  0x00007ffff5c19fbd in QTimer::start (this=0x294c2d8) at
/home/krf/devel/src/qt5/qtbase/src/corelib/kernel/qtimer.cpp:203
3  0x00007fffcd7fabfc in QuickOpenWidget::textChanged (this=0x294c290,
str="") at
/home/krf/devel/src/kf5/extragear/kdevelop/kdevplatform/plugins/quickopen/quickopenplugin.cpp:498
4  0x00007fffcd80b0c0 in
QtPrivate::FunctorCall<QtPrivate::IndexesList<0>,
QtPrivate::List<QString const&>, void, void (QuickOpenWidget::*)(QString
const&)>::call (f=(void (QuickOpenWidget::*)(QuickOpe
nWidget * const, const QString &)) 0x7fffcd7fab98
<QuickOpenWidget::textChanged(QString const&)>, o=0x294c290,
arg=0x7fffffffbdd0) at
/home/krf/devel/build/qt5/qtbase/include/QtCore/../../../../../src/q
t5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:500
5  0x00007fffcd80abd4 in QtPrivate::FunctionPointer<void
(QuickOpenWidget::*)(QString const&)>::call<QtPrivate::List<QString
const&>, void> (f=(void (QuickOpenWidget::*)(QuickOpenWidget * const,
const
QString &)) 0x7fffcd7fab98 <QuickOpenWidget::textChanged(QString
const&)>, o=0x294c290, arg=0x7fffffffbdd0) at
/home/krf/devel/build/qt5/qtbase/include/QtCore/../../../../../src/qt5/qtbase/src/corelib/k
ernel/qobjectdefs_impl.h:519
6  0x00007fffcd80a0a9 in QtPrivate::QSlotObject<void
(QuickOpenWidget::*)(QString const&), QtPrivate::List<QString const&>,
void>::impl (which=1, this_=0x2968930, r=0x294c290, a=0x7fffffffbdd0,
ret=0x0
) at
/home/krf/devel/build/qt5/qtbase/include/QtCore/../../../../../src/qt5/qtbase/src/corelib/kernel/qobject_impl.h:143
7  0x00007ffff5c11527 in QtPrivate::QSlotObjectBase::call
(this=0x2968930, r=0x294c290, a=0x7fffffffbdd0) at
../../include/QtCore/../../../../../src/qt5/qtbase/src/corelib/kernel/qobject_impl.h:124
8  0x00007ffff5c0e330 in QMetaObject::activate (sender=0x1f82fb0,
signalOffset=7, local_signal_index=0, argv=0x7fffffffbdd0) at
/home/krf/devel/src/qt5/qtbase/src/corelib/kernel/qobject.cpp:3702
9  0x00007ffff5c0dc2a in QMetaObject::activate (sender=0x1f82fb0,
m=0x7ffff6e2a520 <QLineEdit::staticMetaObject>, local_signal_index=0,
argv=0x7fffffffbdd0) at /home/krf/devel/src/qt5/qtbase/src/coreli
b/kernel/qobject.cpp:3582
10 0x00007ffff692b834 in QLineEdit::textChanged (this=0x1f82fb0,
_t1="") at .moc/moc_qlineedit.cpp:405
11 0x00007ffff692ae1e in QLineEdit::qt_static_metacall (_o=0x1f82fb0,
_c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7fffffffbfa0) at
.moc/moc_qlineedit.cpp:236
12 0x00007ffff5c0e43a in QMetaObject::activate (sender=0x1f83390,
signalOffset=3, local_signal_index=3, argv=0x7fffffffbfa0) at
/home/krf/devel/src/qt5/qtbase/src/corelib/kernel/qobject.cpp:3716
13 0x00007ffff5c0dc2a in QMetaObject::activate (sender=0x1f83390,
m=0x7ffff6e4c020 <QWidgetLineControl::staticMetaObject>,
local_signal_index=3, argv=0x7fffffffbfa0) at
/home/krf/devel/src/qt5/qtbase/s
rc/corelib/kernel/qobject.cpp:3582
14 0x00007ffff6c17a90 in QWidgetLineControl::textChanged
(this=0x1f83390, _t1="") at .moc/moc_qwidgetlinecontrol_p.cpp:250
15 0x00007ffff69d5f0e in QWidgetLineControl::finishChange
(this=0x1f83390, validateFromState=8, update=false, edited=false) at
/home/krf/devel/src/qt5/qtbase/src/widgets/widgets/qwidgetlinecontrol.cpp:
695
16 0x00007ffff69d47b6 in QWidgetLineControl::clear (this=0x1f83390) at
/home/krf/devel/src/qt5/qtbase/src/widgets/widgets/qwidgetlinecontrol.cpp:280
17 0x00007ffff692699f in QLineEdit::clear (this=0x1f82fb0) at
/home/krf/devel/src/qt5/qtbase/src/widgets/widgets/qlineedit.cpp:1286
18 0x00007fffcd801e9a in QuickOpenLineEdit::deactivate (this=0x1f82fb0)
at
/home/krf/devel/src/kf5/extragear/kdevelop/kdevplatform/plugins/quickopen/quickopenplugin.cpp:1500
19 0x00007fffcd8008ce in QuickOpenLineEdit::widgetDestroyed
(this=0x1f82fb0, obj=0x294c290) at
/home/krf/devel/src/kf5/extragear/kdevelop/kdevplatform/plugins/quickopen/quickopenplugin.cpp:1359
Port away from POSIX cruft

Fixes the MSVC build
Revert "Reintroduce kdewin compatibility library."

No longer needed

This reverts commit b3ad5127ea359f8e98585c21d320b403de687413.
Revert "serialization: Mark util as public dependency"

No longer needed

This reverts commit 31fcccda078798c918e1959272220fbeb2a967ff.
FramestackWidget: properly initialize when a session already exists

While there, clean up redundant (and potentially incorrect) hideEvent and
showEvent.

BUG: 333756
REVIEW: 121568
Fix compile error due to missing declaration of isatty

The compile error actually happened in kdevelop, where this file seems to
be included in a different context than in kdevplatform.