[rkward-cvs] SF.net SVN: rkward-code:[4918] trunk/rkward/rkward
tfry at users.sf.net
tfry at users.sf.net
Thu Oct 16 18:11:55 UTC 2014
Revision: 4918
http://sourceforge.net/p/rkward/code/4918
Author: tfry
Date: 2014-10-16 18:11:55 +0000 (Thu, 16 Oct 2014)
Log Message:
-----------
Remove a small bit of cruft from XMLHelper. Also, fix crash if plugin.xml is not parseable.
Modified Paths:
--------------
trunk/rkward/rkward/misc/xmlhelper.cpp
trunk/rkward/rkward/misc/xmlhelper.h
trunk/rkward/rkward/plugin/rkcomponentmap.cpp
trunk/rkward/rkward/plugin/rkstandardcomponent.cpp
Modified: trunk/rkward/rkward/misc/xmlhelper.cpp
===================================================================
--- trunk/rkward/rkward/misc/xmlhelper.cpp 2014-10-16 18:10:37 UTC (rev 4917)
+++ trunk/rkward/rkward/misc/xmlhelper.cpp 2014-10-16 18:11:55 UTC (rev 4918)
@@ -2,7 +2,7 @@
xmlhelper.cpp - description
-------------------
begin : Fri May 6 2005
- copyright : (C) 2005, 2007, 2011 by Thomas Friedrichsmeier
+ copyright : (C) 2005, 2007, 2011, 2014 by Thomas Friedrichsmeier
email : tfry at users.sourceforge.net
***************************************************************************/
@@ -32,8 +32,6 @@
XMLHelper::XMLHelper () {
RK_TRACE (XML);
-
- highest_error = 0;
}
XMLHelper::~XMLHelper () {
@@ -58,12 +56,12 @@
QDomDocument doc;
XMLHelper::filename = filename;
- highest_error = 0;
QFile f (filename);
- if (!f.open (QIODevice::ReadOnly)) displayError (0, i18n("Could not open file for reading"), debug_level, DL_ERROR);
+ if (!f.open (QIODevice::ReadOnly)) displayError (0, i18n("Could not open file %1 for reading").arg (filename), debug_level, DL_ERROR);
if (!doc.setContent(&f, false, &error_message, &error_line, &error_column)) {
displayError (0, i18n ("Error parsing XML-file. Error-message was: '%1' in line '%2', column '%3'. Expect further errors to be reported below", error_message, error_line, error_column), debug_level, DL_ERROR);
+ return QDomElement ();
}
f.close();
@@ -332,7 +330,6 @@
RK_TRACE (XML);
if (message_level < debug_level) message_level = debug_level;
- if (highest_error < debug_level) highest_error = debug_level;
if ((RK_Debug_Flags & XML) && (message_level >= RK_Debug_Level)) {
QString backtrace = i18n ("XML-parsing '%1' ", filename);
Modified: trunk/rkward/rkward/misc/xmlhelper.h
===================================================================
--- trunk/rkward/rkward/misc/xmlhelper.h 2014-10-16 18:10:37 UTC (rev 4917)
+++ trunk/rkward/rkward/misc/xmlhelper.h 2014-10-16 18:11:55 UTC (rev 4918)
@@ -2,7 +2,7 @@
xmlhelper.h - description
-------------------
begin : Fri May 6 2005
- copyright : (C) 2005, 2007, 2011 by Thomas Friedrichsmeier
+ copyright : (C) 2005, 2007, 2011, 2014 by Thomas Friedrichsmeier
email : tfry at users.sourceforge.net
***************************************************************************/
@@ -134,9 +134,6 @@
* @returns the contents as a QString (may be empty) */
QString getRawContents (const QDomElement &element, int debug_level);
-/** @returns the level of the most severe error since the last call to openXMLFile () (based on the debug_level options passed to XMLHelper () */
- int highestError () { return (highest_error); };
-
/** displays a custom-error message (also used internally by XMLHelper to display errors
@param in_node a pointer to the node/element to which the error relates (or 0). If given and non-zero, a "backtrace" of where the error is located will be generated
@param message the error-message to display
@@ -150,7 +147,6 @@
/** copy the node list into a child list. The main effect is that a child list is not updated according to document changes */
XMLChildList nodeListToChildList (const QDomNodeList &from);
void replaceWithChildren (QDomNode *replaced, const QDomElement &replacement_parent);
- int highest_error;
static XMLHelper *static_xml_helper;
QString filename;
};
Modified: trunk/rkward/rkward/plugin/rkcomponentmap.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkcomponentmap.cpp 2014-10-16 18:10:37 UTC (rev 4917)
+++ trunk/rkward/rkward/plugin/rkcomponentmap.cpp 2014-10-16 18:11:55 UTC (rev 4918)
@@ -2,7 +2,7 @@
rkcomponentmap.cpp - description
-------------------
begin : Thu May 12 2005
- copyright : (C) 2005-2013 by Thomas Friedrichsmeier
+ copyright : (C) 2005-2014 by Thomas Friedrichsmeier
email : tfry at users.sourceforge.net
***************************************************************************/
@@ -354,7 +354,7 @@
XMLChildList list;
QDomElement document_element = xml->openXMLFile (plugin_map_file_abs, DL_ERROR);
- if (xml->highestError () >= DL_ERROR) {
+ if (document_element.isNull ()) {
ret.addAndPrintError (DL_ERROR, i18n ("Could not open plugin map file %1. (Is not readble, or failed to parse)", plugin_map_file_abs));
return ret;
}
Modified: trunk/rkward/rkward/plugin/rkstandardcomponent.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkstandardcomponent.cpp 2014-10-16 18:10:37 UTC (rev 4917)
+++ trunk/rkward/rkward/plugin/rkstandardcomponent.cpp 2014-10-16 18:11:55 UTC (rev 4918)
@@ -2,7 +2,7 @@
rkstandardcomponent - description
-------------------
begin : Sun Feb 19 2006
- copyright : (C) 2006, 2007, 2009, 2010, 2011, 2012 by Thomas Friedrichsmeier
+ copyright : (C) 2006, 2007, 2009, 2010, 2011, 2012, 2014 by Thomas Friedrichsmeier
email : tfry at users.sourceforge.net
***************************************************************************/
@@ -91,7 +91,7 @@
// open the main description file for parsing
XMLHelper* xml = XMLHelper::getStaticHelper ();
QDomElement doc_element = xml->openXMLFile (filename, DL_ERROR);
- if (xml->highestError () >= DL_ERROR) {
+ if (doc_element.isNull ()) {
KMessageBox::error (this, i18n ("There has been an error while trying to parse the description of this plugin ('%1'). Please refer to stdout for details.", filename), i18n ("Could not create plugin"));
kill ();
return;
@@ -170,7 +170,7 @@
RK_TRACE (PLUGIN);
if (gui) delete gui; // NOTE: *NOT* using gui->deleteLater (). Destructing the GUI immediately is necessary to get rid of child components, immediately. Otherwise these could try to access their (destroyed) parent, e.g. if they have a timer running that gets triggered before the deletion event arrives.
- backend->destroy (); // it will self-destruct, when it has closed the process.
+ if (backend) backend->destroy (); // it will self-destruct, when it has closed the process.
}
void RKStandardComponent::kill () {
More information about the rkward-tracker
mailing list