Commit 503fdd02 authored by Robert Knight's avatar Robert Knight

Fix several memory leaks and uninitialized variables found with valgrind.

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=696508
parent ff29241c
......@@ -197,10 +197,14 @@ void EditProfileDialog::setupGeneralPage(const Profile* info)
_ui->commandEdit->setText( command.fullCommand() );
KUrlCompletion* exeCompletion = new KUrlCompletion(KUrlCompletion::ExeCompletion);
exeCompletion->setParent(this);
exeCompletion->setDir(QString());
_ui->commandEdit->setCompletionObject( exeCompletion );
_ui->initialDirEdit->setText( info->defaultWorkingDirectory() );
_ui->initialDirEdit->setCompletionObject( new KUrlCompletion(KUrlCompletion::DirCompletion) );
KUrlCompletion* dirCompletion = new KUrlCompletion(KUrlCompletion::DirCompletion);
dirCompletion->setParent(this);
_ui->initialDirEdit->setCompletionObject( dirCompletion );
_ui->initialDirEdit->setClearButtonShown(true);
_ui->dirSelectButton->setIcon( KIcon("folder-open") );
_ui->iconSelectButton->setIcon( KIcon(info->icon()) );
......
......@@ -46,7 +46,10 @@ KeyboardTranslatorManager::KeyboardTranslatorManager()
: _haveLoadedAll(false)
{
}
KeyboardTranslatorManager::~KeyboardTranslatorManager()
{
qDeleteAll(_translators.values());
}
QString KeyboardTranslatorManager::findTranslatorPath(const QString& name)
{
return KGlobal::dirs()->findResource("data","konsole/"+name+".keytab");
......
......@@ -423,6 +423,7 @@ public:
* first requested via a call to findTranslator()
*/
KeyboardTranslatorManager();
~KeyboardTranslatorManager();
/**
* Adds a new translator. If a translator with the same name
......
......@@ -193,8 +193,13 @@ void Pty::setWriteable(bool writeable)
}
Pty::Pty()
: _bufferFull(false),
_windowColumns(0),
_windowLines(0),
_eraseChar(0),
_xonXoff(true),
_utf8(true)
{
_bufferFull = false;
connect(this, SIGNAL(receivedStdout(K3Process *, char *, int )),
this, SLOT(dataReceived(K3Process *,char *, int)));
connect(this, SIGNAL(processExited(K3Process *)),
......
......@@ -640,7 +640,7 @@ QVector<LineProperty> Screen::getCookedLineProperties( int startLine )
/*!
*/
void Screen::reset()
void Screen::reset(bool clearScreen)
{
setMode(MODE_Wrap ); saveMode(MODE_Wrap ); // wrap at end of margin
resetMode(MODE_Origin); saveMode(MODE_Origin); // position refere to [1,1]
......@@ -655,7 +655,8 @@ void Screen::reset()
setDefaultRendition();
saveCursor();
clear();
if ( clearScreen )
clear();
}
/*! Clear the entire screen and home the cursor.
......
......@@ -176,7 +176,7 @@ public: // these are all `Screen' operations
//
void clear();
void home();
void reset();
void reset(bool clearScreen = true);
// Show character
void ShowCharacter(unsigned short c);
......
......@@ -201,6 +201,8 @@ QString SessionController::currentDir() const
bool ok = false;
QString path = info->currentDir(&ok);
delete info;
if ( ok )
return path;
else
......@@ -510,7 +512,7 @@ void SessionController::setupActions()
action->setText( i18n("Edit Current Profile...") );
connect( action , SIGNAL(triggered()) , this , SLOT(editCurrentProfile()) );
_changeProfileMenu = new KMenu(i18n("Change Profile"));
_changeProfileMenu = new KMenu(i18n("Change Profile"),_view);
collection->addAction("change-profile",_changeProfileMenu->menuAction());
connect( _changeProfileMenu , SIGNAL(aboutToShow()) , this , SLOT(prepareChangeProfileMenu()) );
......
......@@ -184,21 +184,21 @@ void SessionManager::loadAllProfiles()
_loadedAllProfiles = true;
}
SessionManager::~SessionManager()
{
{
// save default profile
setDefaultProfile( _defaultProfile );
// save shortcuts
saveShortcuts();
// delete remaining sessions
qDeleteAll(_sessions);
// free profiles
QListIterator<Profile*> infoIter(_types.values());
while (infoIter.hasNext())
delete infoIter.next();
//#warning "This prevents a crash to do with accessing a global static globalData() after destruction, but it is probably not the correct solution."
// KGlobal::config()->sync();
}
const QList<Session*> SessionManager::sessions()
......
......@@ -83,11 +83,13 @@ using namespace Konsole;
/* ------------------------------------------------------------------------- */
Vt102Emulation::Vt102Emulation() : Emulation()
Vt102Emulation::Vt102Emulation()
: Emulation(),
_titleUpdateTimer(new QTimer(this))
{
_titleUpdateTimer.setSingleShot(true);
_titleUpdateTimer->setSingleShot(true);
QObject::connect(&_titleUpdateTimer , SIGNAL(timeout()) , this , SLOT(updateTitle()));
QObject::connect(_titleUpdateTimer , SIGNAL(timeout()) , this , SLOT(updateTitle()));
initTokenizer();
reset();
......@@ -370,7 +372,7 @@ void Vt102Emulation::XtermHack()
// (btw: arg=0 changes title and icon, arg=1 only icon, arg=2 only title
// emit changeTitle(arg,unistr);
_pendingTitleUpdates[arg] = unistr;
_titleUpdateTimer.start(20);
_titleUpdateTimer->start(20);
delete [] str;
}
......
......@@ -182,7 +182,7 @@ private:
//these calls occur when certain escape sequences are seen in the
//output from the terminal
QHash<int,QString> _pendingTitleUpdates;
QTimer _titleUpdateTimer;
QTimer* _titleUpdateTimer;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment