kwin: repalce abort() calls with kFatal()

kFatal() also aborts but logs a message (if configured to do so)

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-06-10 21:30:15 +03:00
parent 0b0b9261e5
commit 39644edba3
12 changed files with 54 additions and 46 deletions

View file

@ -601,7 +601,7 @@ void Client::detectNoBorder()
noborder = false;
break;
default:
abort();
kFatal() << "Something strange happened";
}
}

View file

@ -997,7 +997,7 @@ bool Client::shouldUnredirect() const
if (c->geometry().intersects(geometry()))
return false;
}
abort();
kFatal() << "Something strange happened";
}
return false;
}
@ -1023,7 +1023,7 @@ bool Unmanaged::shouldUnredirect() const
if (c->geometry().intersects(geometry()))
return false;
}
abort();
kFatal() << "Something strange happened";
}
return false;
}

View file

@ -1543,21 +1543,24 @@ const EffectWindowGroup* EffectWindowImpl::group() const
{
if (Client* c = qobject_cast< Client* >(toplevel))
return c->group()->effectGroup();
return NULL; // TODO
// TODO
return NULL;
}
void EffectWindowImpl::refWindow()
{
if (Deleted* d = qobject_cast< Deleted* >(toplevel))
return d->refWindow();
abort(); // TODO
// TODO
kFatal() << "Something strange happened";
}
void EffectWindowImpl::unrefWindow()
{
if (Deleted* d = qobject_cast< Deleted* >(toplevel))
return d->unrefWindow(); // delays deletion in case
abort(); // TODO
// TODO
kFatal() << "Something strange happened";
}
void EffectWindowImpl::setWindow(Toplevel* w)

View file

@ -1863,7 +1863,8 @@ EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, i
}
}
abort(); // Should never get here
// Should never get here
kFatal() << "Something strange happened";
}
EffectWindow* PresentWindowsEffect::findFirstWindow() const

View file

@ -313,7 +313,7 @@ QRect Workspace::clientArea(clientAreaOption opt, int screen, int desktop) const
case FullArea:
return QRect(0, 0, displayWidth(), displayHeight());
}
abort();
kFatal() << "Something strange happened";
}
@ -650,7 +650,7 @@ QRect Workspace::adjustClientSize(Client* c, QRect moveResizeGeom, int mode)
SNAP_BORDER_LEFT
break;
default:
abort();
kFatal() << "Something strange happened";
break;
}
@ -779,7 +779,7 @@ QRect Workspace::adjustClientSize(Client* c, QRect moveResizeGeom, int mode)
SNAP_WINDOW_C_LEFT
break;
default:
abort();
kFatal() << "Something strange happened";
break;
}
}
@ -987,7 +987,7 @@ StrutRect Client::strutRect(StrutArea area) const
), StrutAreaLeft);
break;
default:
abort(); // Not valid
kFatal() << "Something strange happened"; // Not valid
}
return StrutRect(); // Null rect
}
@ -2836,7 +2836,7 @@ void Client::handleMoveResize(int x, int y, int x_root, int y_root)
break;
case PositionCenter:
default:
abort();
kFatal() << "Something strange happened";
break;
}
// adjust new size to snap to other windows/borders
@ -2936,7 +2936,7 @@ void Client::handleMoveResize(int x, int y, int x_root, int y_root)
break;
case PositionCenter:
default:
abort();
kFatal() << "Something strange happened";
break;
}
@ -3026,8 +3026,9 @@ void Client::handleMoveResize(int x, int y, int x_root, int y_root)
}
if (moveResizeGeom.topLeft() != previousMoveResizeGeom.topLeft())
update = true;
} else
abort();
} else {
kFatal() << "Something strange happened";
}
if (!update)
return;

View file

@ -153,7 +153,7 @@ static void checkTransiency()
if (!performTransiencyCheck()) {
kDebug(1212) << "BT:" << transiencyCheckStartBt;
kDebug(1212) << "CLIENT:" << transiencyCheckClient;
abort();
kFatal() << "Something strange happened";
}
transiencyCheckNonExistent = false;
}

View file

@ -46,6 +46,7 @@
#include <QScrollBar>
#include <QUiLoader>
// KDE
#include <KDebug>
#include <KAboutData>
#include <KDialog>
#include <KLocalizedString>
@ -54,7 +55,6 @@
#include <KConfigDialogManager>
#include <KPluginFactory>
#include <Plasma/ConfigLoader>
#include <qdeclarative.h>
// KCModule plugin interface
// =========================
@ -124,7 +124,7 @@ void KWinDecorationModule::init()
"The resource<h2>kwin/kcm_kwindecoration/main.qml</h2>could not be located in any application data path."
"<h2>Please contact your distribution</h2>"
"The application will now abort", "Installation Error");
abort();
kFatal() << "Something strange happened";
}
KConfigGroup style(kwinConfig, "Style");

View file

@ -273,7 +273,8 @@ static const char* tbl_num_lookup(const char* const arr[], int pos)
return arr[ i ];
--pos;
}
abort(); // should never happen this way
// should never happen this way
kFatal() << "Something strange happened";
}
static int tbl_txt_lookup(const char* const arr[], const char* txt)
@ -291,20 +292,21 @@ static int tbl_txt_lookup(const char* const arr[], const char* txt)
void KTitleBarActionsConfig::setComboText(KComboBox* combo, const char*txt)
{
if (combo == m_ui->coTiDbl)
if (combo == m_ui->coTiDbl) {
combo->setCurrentIndex(tbl_txt_lookup(tbl_TiDbl, txt));
else if (combo == m_ui->coTiAct1 || combo == m_ui->coTiAct2 || combo == m_ui->coTiAct3)
} else if (combo == m_ui->coTiAct1 || combo == m_ui->coTiAct2 || combo == m_ui->coTiAct3) {
combo->setCurrentIndex(tbl_txt_lookup(tbl_TiAc, txt));
else if (combo == m_ui->coTiInAct1 || combo == m_ui->coTiInAct2 || combo == m_ui->coTiInAct3)
} else if (combo == m_ui->coTiInAct1 || combo == m_ui->coTiInAct2 || combo == m_ui->coTiInAct3) {
combo->setCurrentIndex(tbl_txt_lookup(tbl_TiInAc, txt));
else if (combo == m_ui->coTiAct4)
} else if (combo == m_ui->coTiAct4) {
combo->setCurrentIndex(tbl_txt_lookup(tbl_TiWAc, txt));
else if (combo == m_ui->leftClickMaximizeButton ||
} else if (combo == m_ui->leftClickMaximizeButton ||
combo == m_ui->middleClickMaximizeButton ||
combo == m_ui->rightClickMaximizeButton) {
combo->setCurrentIndex(tbl_txt_lookup(tbl_Max, txt));
} else
abort();
} else {
kFatal() << "Something strange happened";
}
}
const char* KTitleBarActionsConfig::functionTiDbl(int i)
@ -427,18 +429,19 @@ KWindowActionsConfig::~KWindowActionsConfig()
void KWindowActionsConfig::setComboText(KComboBox* combo, const char*txt)
{
if (combo == m_ui->coWin1 || combo == m_ui->coWin2 || combo == m_ui->coWin3)
if (combo == m_ui->coWin1 || combo == m_ui->coWin2 || combo == m_ui->coWin3) {
combo->setCurrentIndex(tbl_txt_lookup(tbl_Win, txt));
else if (combo == m_ui->coWinWheel)
} else if (combo == m_ui->coWinWheel) {
combo->setCurrentIndex(tbl_txt_lookup(tbl_WinWheel, txt));
else if (combo == m_ui->coAllKey)
} else if (combo == m_ui->coAllKey) {
combo->setCurrentIndex(tbl_txt_lookup(tbl_AllKey, txt));
else if (combo == m_ui->coAll1 || combo == m_ui->coAll2 || combo == m_ui->coAll3)
} else if (combo == m_ui->coAll1 || combo == m_ui->coAll2 || combo == m_ui->coAll3) {
combo->setCurrentIndex(tbl_txt_lookup(tbl_All, txt));
else if (combo == m_ui->coAllW)
} else if (combo == m_ui->coAllW) {
combo->setCurrentIndex(tbl_txt_lookup(tbl_AllW, txt));
else
abort();
} else {
kFatal() << "Something strange happened";
}
}
const char* KWindowActionsConfig::functionWin(int i)

View file

@ -167,7 +167,7 @@ int Monitor::selectedEdgeItem(int edge) const
if (act->isChecked())
return popup_actions[ edge ].indexOf(act);
}
abort();
kFatal() << "Something strange happened";
}
void Monitor::popup(Corner* c, QPoint pos)
@ -187,7 +187,7 @@ void Monitor::popup(Corner* c, QPoint pos)
return;
}
}
abort();
kFatal() << "Something strange happened";
}
void Monitor::flip(Corner* c, QPoint pos)
@ -203,7 +203,7 @@ void Monitor::flip(Corner* c, QPoint pos)
return;
}
}
abort();
kFatal() << "Something strange happened";
}
Monitor::Corner::Corner(Monitor* m)

View file

@ -1223,7 +1223,7 @@ bool PaintClipper::Iterator::isDone()
if (effects->compositingType() == XRenderCompositing)
return data->index == 1; // run once
#endif
abort();
kFatal() << "Something strange happened";
}
void PaintClipper::Iterator::next()
@ -1239,7 +1239,7 @@ QRect PaintClipper::Iterator::boundingRect() const
if (effects->compositingType() == XRenderCompositing)
return paintArea().boundingRect();
#endif
abort();
kFatal() << "Something strange happened";
return infiniteRegion();
}
@ -1429,8 +1429,11 @@ void WindowMotionManager::apply(EffectWindow *w, WindowPaintData &data)
void WindowMotionManager::moveWindow(EffectWindow *w, QPoint target, double scale, double yScale)
{
QHash<EffectWindow*, WindowMotion>::iterator it = m_managedWindows.find(w);
if (it == m_managedWindows.end())
abort(); // Notify the effect author that they did something wrong
if (it == m_managedWindows.end()) {
// Notify the effect author that they did something wrong
kFatal() << "Something strange happened";
return;
}
WindowMotion *motion = &it.value();

View file

@ -265,10 +265,6 @@ bool Application::setup()
// initting = false; // TODO
// This tries to detect compositing options and can use GLX. GLX problems
// (X errors) shouldn't cause kwin to abort, so this is out of the
// critical startup section where x errors cause kwin to abort.
// create workspace.
(void) new Workspace(isSessionRestored());

View file

@ -193,8 +193,9 @@ void UserActionsMenu::helperDialog(const QString& message, const QWeakPointer<Cl
"activated using the %1 keyboard shortcut.",
shortcut);
type = "altf3warning";
} else
abort();
} else {
kFatal() << "Something strange happened";
}
if (!type.isEmpty()) {
KConfig cfg("kwin_dialogsrc");
KConfigGroup cg(&cfg, "Notification Messages"); // Depends on KMessageBox