Fixed some of memory leaks and sigsev and bugs
[mdictionary] / trunk / src / plugins / xdxf / src / TranslationXdxf.cpp
index 190e255..ee06a42 100644 (file)
 TranslationXdxf::TranslationXdxf() {
 }
 
-TranslationXdxf::TranslationXdxf(QString _key, QString _dictionaryInfo, XdxfPlugin *xdxfPlugin): _key(_key),_dictionaryInfo(_dictionaryInfo) {
+TranslationXdxf::TranslationXdxf(QString _key, QString _dictionaryInfo,
+         XdxfPlugin *xdxfPlugin): _key(_key),_dictionaryInfo(_dictionaryInfo) {
     this->xdxfPlugin=xdxfPlugin;
+    if(xdxfPlugin)
+        _dictHash = xdxfPlugin->hash();
 }
 
 QString TranslationXdxf::key() const {
@@ -39,11 +42,12 @@ QString TranslationXdxf::dictionaryInfo() const {
 
 QString TranslationXdxf::toHtml() const {
     QString result("");
-//    qDebug()<<xdxfPlugin->search(_key);
-    result+="<dict>" + _dictionaryInfo + "<key>" + _key + "</key>"  +xdxfPlugin->search(_key) + "</dict>";
+    if(!xdxfPlugin)
+        return result;
+    result+="<dict>" + _dictionaryInfo + "<key>" + _key + "</key>"  +
+            xdxfPlugin->search(_key) + "</dict>";
     result.replace("&","&amp;");
 
-//    qDebug()<<result;
     return result;
 }