[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/kdeui
From: David Faure <faure () kde ! org>
Date: 2010-11-18 20:33:49
Message-ID: 20101118203349.38960AC8A0 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1198536 by dfaure:
Warn when a xmlguiclient was deleted without being removed from the xmlguifactory \
first. This would crash until kdelibs-4.5.2, where it crashed in other cases (see \
r1197480) :) Now it doesn't crash (hopefully), but it warns because it leaks e.g. \
popup-menus.
CCBUG: 246652
M +12 -5 tests/kxmlgui_unittest.cpp
M +4 -0 xmlgui/kxmlguiclient.cpp
M +1 -1 xmlgui/kxmlguiclient.h
--- trunk/KDE/kdelibs/kdeui/tests/kxmlgui_unittest.cpp #1198535:1198536
@@ -317,7 +317,7 @@
<< "host_after_merge" << "host_after_merge_2" << \
"last_from_host"
<< "file_new" << "file_open" << "file_quit");
hostClient.createGUI(hostXml, true /*ui_standards.rc*/);
- QMainWindow mainWindow;
+ KMainWindow mainWindow;
KXMLGUIBuilder builder(&mainWindow);
KXMLGUIFactory factory(&builder);
factory.addClient(&hostClient);
@@ -407,6 +407,8 @@
<< "separator"
<< "file_quit"
<< "other_file_action");
+ factory.removeClient(&partClient);
+ factory.removeClient(&hostClient);
}
void KXmlGui_UnitTest::testPartMergingSettings() // #252911
@@ -429,7 +431,7 @@
hostClient.createActions(QStringList() << "options_configure_keybinding" << \
"options_configure_toolbars"); hostClient.createGUI(hostXml, true \
/*ui_standards.rc*/); //kDebug() << hostClient.domDocument().toString();
- QMainWindow mainWindow;
+ KMainWindow mainWindow;
KXMLGUIBuilder builder(&mainWindow);
KXMLGUIFactory factory(&builder);
factory.addClient(&hostClient);
@@ -455,6 +457,8 @@
<< "options_configure_keybinding"
<< "options_configure_toolbars"
<< "configure_klinkstatus");
+ factory.removeClient(&partClient);
+ factory.removeClient(&hostClient);
}
void KXmlGui_UnitTest::testUiStandardsMerging_data()
@@ -564,7 +568,7 @@
QCOMPARE(docElem.attribute("name"), QString("foo")); // not standard_containers \
from ui_standards.rc
QCOMPARE(docElem.attribute("version"), QString("1")); // not standard_containers \
from ui_standards.rc
- QMainWindow mainWindow;
+ KMainWindow mainWindow;
KXMLGUIBuilder builder(&mainWindow);
KXMLGUIFactory factory(&builder);
factory.addClient(&client);
@@ -572,6 +576,8 @@
const QStringList containerNames = collectMenuNames(factory);
//kDebug() << containerNames;
QCOMPARE(containerNames, expectedMenus);
+
+ factory.removeClient(&client);
}
void KXmlGui_UnitTest::testActionListAndSeparator()
@@ -591,7 +597,7 @@
TestGuiClient client(xml);
client.createActions(QStringList() << "view_add_to_new_group");
- QMainWindow mainWindow;
+ KMainWindow mainWindow;
KXMLGUIBuilder builder(&mainWindow);
KXMLGUIFactory factory(&builder);
factory.addClient(&client);
@@ -642,6 +648,7 @@
<< "action1"
<< "separator"
<< "view_add_to_new_group");
+ factory.removeClient(&client);
}
void KXmlGui_UnitTest::testHiddenToolBar()
@@ -760,7 +767,7 @@
}
}
-void KXmlGui_UnitTest::testDeletedContainers()
+void KXmlGui_UnitTest::testDeletedContainers() // deleted="true"
{
const QByteArray xml =
"<?xml version = '1.0'?>\n"
--- trunk/KDE/kdelibs/kdeui/xmlgui/kxmlguiclient.cpp #1198535:1198536
@@ -97,6 +97,7 @@
}
if ( d->m_factory ) {
+ kWarning(240) << this << "deleted without having been removed from the factory \
first. This will leak standalone popupmenus and could lead to crashes."; \
d->m_factory->forgetClient(this); }
@@ -163,6 +164,9 @@
if ( !QDir::isRelativePath(d->m_xmlFile) )
return QString(); // can't save anything here
+ if (d->m_xmlFile.isEmpty()) // setXMLFile not called at all, can't save. Use \
case: ToolBarHandler + return QString();
+
return KStandardDirs::locateLocal( "data", componentData().componentName() + '/' + \
d->m_xmlFile ); }
--- trunk/KDE/kdelibs/kdeui/xmlgui/kxmlguiclient.h #1198535:1198536
@@ -271,7 +271,7 @@
void prepareXMLUnplug( QWidget * );
/**
- * Sets a new xmlFile() and localXMLFile(). The purpose of this pulic
+ * Sets a new xmlFile() and localXMLFile(). The purpose of this public
* method is to allow non-inherited objects to replace the ui definition
* of an embedded client with a customized version. It corresponds to the
* usual calls to setXMLFile() and setLocalXMLFile().
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic