OSDN Git Service

Fixed several critical bugs.
authortkawata <takuji.kawata@gmail.com>
Fri, 9 Mar 2012 00:49:06 +0000 (09:49 +0900)
committertkawata <takuji.kawata@gmail.com>
Fri, 9 Mar 2012 00:49:06 +0000 (09:49 +0900)
dennco content file syntax change is in progress.
Compile with MSV2008 is enabled.(Under Qt)

14 files changed:
Source/DNContainerBuilder.cpp
Source/DNContainerBuilder.h
Source/DNFileList.h
Source/DNHTTPServer.cpp
Source/DNUtils.cpp
Source/DNXMLElement.cpp
Source/QtScript/dnqsbasiccell.h
Source/QtScript/dnqscellcodeinstance.cpp
Source/QtScript/dnqscellcodeinstance.h
Source/QtScript/dnqscontainer.cpp
Source/QtScript/dnqscontainer.h
Source/TKAxonTerminal.h
Source/TKDebug.h
Source/platform/qt/qtdndirectoryimpl.cpp

index a9b93d5..1ba5a85 100644 (file)
@@ -16,6 +16,7 @@
 //
 //  Created by tkawata on 1/6/2012.
 //
+#include "DNContainerBuilder.h"
 
 #include "TKLock.h"
 #include "TKContainer.h"
@@ -28,8 +29,7 @@
 #include "DNUtils.h"
 #include "TKCell.h"
 #include "TKDebug.h"
-
-#include "DNContainerBuilder.h"
+#include "DNGlobal.h"
 
 DNContainerBuilder::DNContainerBuilder(TKContainer *container) : mContainer(container) 
 {
@@ -43,22 +43,22 @@ DNContainerBuilder::~DNContainerBuilder()
 
 bool DNContainerBuilder::buildContainerFromXHTML(const char* docRoot)
 {
-
     mLock.lock();
     
     mContainer->setContentPath(std::string(docRoot));
 
     DNDirectory directory(docRoot);
-    const DNFileList *flist = directory.getFileList("html|htm|xml");
-    
+    const DNFileList *flist = directory.getFileList("html|htm|xml|xhtml");
+
     //parse XHTML files
     while(flist)
     {
-        parseXHTML(docRoot, flist->filePath.c_str());
+        std::string p = flist->getFilePath();
+        parseXHTML(docRoot, p.c_str());
 
         flist = flist->next;
     }
-    
+
     //build cells
     while(!mPendingCellDefinitions.empty())
     {
@@ -67,11 +67,28 @@ bool DNContainerBuilder::buildContainerFromXHTML(const char* docRoot)
         TKCell *newCell = NULL;
         if (cellCode)
         {
-            newCell = mContainer->createCell(cellInfo->location, cellInfo->cellName, cellCode, cellInfo->startupScript);
+            newCell = mContainer->createCell(cellInfo->location, cellInfo->cellName, cellCode, cellInfo->customScript);
+        }
+        else
+        {
+            std::string message = std::string("Failed to construct cell: ").append(cellInfo->location).append("#").append(cellInfo->cellName);
+            message.append("\nCellCode '").append(cellInfo->cellCodeName).append("' couldn't be found.");
+            TKLog::printf("%s", message.c_str());
+            if (dnGlobal()->updateErrorStatus(DNGlobal::ERROR))
+            {
+                dnGlobal()->setMessage1("Initialization failed");
+                dnGlobal()->setMessage2(message);
+            }
         }
         if (newCell == NULL)
         {
-            TKLog::printf("Failed to construct cell:%s.",cellInfo->cellName.c_str());
+            std::string message = std::string("Failed to construct cell: ").append(cellInfo->location).append("#").append(cellInfo->cellName);
+            TKLog::printf("%s", message.c_str());
+            if (dnGlobal()->updateErrorStatus(DNGlobal::ERROR))
+            {
+                dnGlobal()->setMessage1("Initialization failed");
+                dnGlobal()->setMessage2(message);
+            }
         }
         mPendingCellDefinitions.pop();
     }
@@ -89,174 +106,138 @@ bool DNContainerBuilder::buildContainerFromXHTML(const char* docRoot)
         }
         else
         {
-            TKLog::printf("Failed to make connection (%s) cell:%s -> cell:%s", connInfo->connectionName.c_str(),connInfo->originCellName.c_str(), connInfo->targetCellName.c_str());            
+            std::string message = std::string("Failed to make connection (").append(connInfo->connectionName).append(" cell:").append(connInfo->originCellName).append(" - > ").append(connInfo->targetCellName);
+            TKLog::printf("%s", message.c_str());
+            if (dnGlobal()->updateErrorStatus(DNGlobal::ERROR))
+            {
+                dnGlobal()->setMessage1("Initialization failed");
+                dnGlobal()->setMessage2(message);
+            }
         }
         mPendingConnections.pop();
     }
-    
     mLock.unlock();
-    
+
     return true;
 }
 
+void DNContainerBuilder::addCell(const char *path, std::string name, std::string cellcode, std::string customScript)
+{
+    DEBUG_TRACE("\n===== Define cell ================ \nName:%s/%s\nClass:%s\nCustom script:\n%s\n", path,name.c_str(), cellcode.c_str(),customScript.c_str());
+
+    PendingCellDefinition *newCellDefine = new PendingCellDefinition();
+    newCellDefine->location = path;
+    newCellDefine->cellName = name;
+    newCellDefine->cellCodeName = getFQNString(path, cellcode.c_str());
+    newCellDefine->customScript = customScript;
+
+    mPendingCellDefinitions.push(newCellDefine);
+}
+
+void DNContainerBuilder::addCellCode(const char *path, std::string name, std::string type, std::string cellScript)
+{
+    std::string fqnName = getFQNString(path, name.c_str());
+
+    DEBUG_TRACE("\n===== Define cell code class ===== \nClass:%s\nAPI:%s\n%s\n", fqnName.c_str(), type.c_str(), cellScript.c_str());
+
+    mContainer->createCellCode(fqnName, type, cellScript);
+}
+
+void DNContainerBuilder::addConnection(const char *path, std::string origine, std::string destination, std::string name)
+{
+    PendingCellConnection *newConnection = new PendingCellConnection();
+    newConnection->connectionName = name;
+    newConnection->originCellName = getFQNString(path, origine.c_str());
+    newConnection->targetCellName = getFQNString(path, destination.c_str());
+    mPendingConnections.push(newConnection);
+}
+
 void DNContainerBuilder::parseXHTML(const char *docRoot, const char *path)
 {
-    
     DNXML *xml = DNXML::createXMLFromFile(docRoot, path);
     DNXMLElement *element = xml->getRoot();
     
-    DNXMLElement *classElement = NULL;
-    DNXMLElement *classScriptElement = NULL;
-    DNXMLElement *classAPIElement = NULL;
-    std::string  className;
-
-    DNXMLElement *cellElement = NULL;
-    DNXMLElement *cellScriptElement = NULL;
     std::string  cellName;
-    std::string  cellCodeClassName;
-    
+    std::string  cellCodeName;
+    std::string  cellAPIType;
+    std::string  script;
+
+    int defineDepth = -1;
+
     while(element)
     {
-        std::string eclass = element->getAttributeValue("class");
-        if (eclass == "dennco-script")
+        std::string define = element->getAttributeValue("define");
+        if (define.length() > 0)
         {
-            DNXMLElement *te = element->outer;
-            while(te)
+            if (defineDepth > 0)
             {
-                std::string teclass = te->getAttributeValue("class");
-                if (teclass == "dennco-classdef")
-                {
-                    if (classElement && classElement == te)
-                    {
-                        classScriptElement = element;
-                    }
-                    else
-                    {                    
-                        TKLog::printf("A syntax error is found in %s. dennco-script isn't properly defined.",path);
-                    }
-                    
-                    break;
-                }
-                else if (teclass == "dennco-cell")
+                std::string message = std::string("Syntax error while parsing ").append(path).append(". A defnie element seems to be nested.");
+                TKLog::printf("%s", message.c_str());
+                if (dnGlobal()->updateErrorStatus(DNGlobal::ERROR))
                 {
-                    if (cellElement && cellElement == te)
-                    {
-                        std::string s = element->getAttributeValue("href");
-                        if (s.length() > 0)
-                        {
-                            cellCodeClassName = s;
-                        }
-                        else
-                        {
-                            cellScriptElement = element;
-                        }
-                    }
-                    else
-                    {
-                        TKLog::printf("A syntax error is found in %s. dennco-script isn't properly defined.",path);
-                    }
-                    
-                    break;
+                    dnGlobal()->setMessage1("Initialization failed");
+                    dnGlobal()->setMessage2(message);
                 }
-                te = te->outer;
-            }
-            if (!te)
-            {
-                TKLog::printf("A syntax error is found in %s. dennco-script doesn't belong to any of dennco-classdef or dennco-cell.", path);
             }
-            
-        }
-        else if (eclass == "dennco-classdef")
-        {            
-            className = element->getAttributeValue("name");
-            if (className.length() > 0)
+            else
             {
-                if (!classElement)
+                if (define == "cell")
                 {
-                    classElement = element;
+                    cellName = element->getAttributeValue("name");
+                    defineDepth = element->depth;
+                }
+                else if (define == "cellcode")
+                {
+                    cellCodeName = element->getAttributeValue("name");
+                    cellAPIType = element->getAttributeValue("type");
+                    defineDepth = element->depth;
                 }
                 else
                 {
-                    TKLog::printf("A syntax error is found in %s. Nested dennco-classdef?", path);
+                    std::string message = std::string("Syntax error while parsing ").append(path).append(". defnie='").append("' isn't correct.");
+                    TKLog::printf("%s", message.c_str());
+                    if (dnGlobal()->updateErrorStatus(DNGlobal::ERROR))
+                    {
+                        dnGlobal()->setMessage1("Initialization failed");
+                        dnGlobal()->setMessage2(message);
+                    }
                 }
             }
-            else
-            {
-                TKLog::printf("A syntax error is found in %s. dennco-classdef doesn't have name attribute", path);                
-            }
         }
-        else if (eclass == "dennco-cell")
+
+        std::string parameter = element->getAttributeValue("parameter");
+        if (parameter.length() > 0)
         {
-            cellName = element->getAttributeValue("name");
-            trimString(cellName);
-            if (cellName.length() > 0)
+            if (parameter == "script")
             {
-                if (!cellElement)
-                {
-                    cellElement = element;
-                }
-                else
-                {
-                    TKLog::printf("A syntax error is found in %s. Nested dennco-cell?", path);
-                }
+                script = element->text;
             }
-            else
+            else if (parameter == "cellcode")
             {
-                TKLog::printf("A syntax error is found in %s. dennco-cell doesn't have name attribute", path);
+                cellCodeName = element->getAttributeValue("href");
             }
-        }
-        else if (eclass == "dennco-connect")
-        {
-            if (cellElement)
+            else if (parameter== "connection")
             {
-                //connection
                 std::string target = element->getAttributeValue("href");
-                trimString(target);
-                if (target.length() > 0)
-                {
-                    PendingCellConnection *newConnection = new PendingCellConnection();
-                    newConnection->connectionName = getFQNString(path, cellName.c_str());
-                    newConnection->originCellName = getFQNString(path, cellName.c_str());
-                    newConnection->targetCellName = getFQNString(path, target.c_str());
-                    mPendingConnections.push(newConnection);
-                }
-                else
+                std::string rname = element->getAttributeValue("receptor");
+                if (rname.length()==0)
                 {
-                    TKLog::printf("A syntax error is found in %s. dennco-connect doesn't have link target (href) attribute.", path);                    
+                    rname = cellName;
                 }
+                addConnection(path, cellName, target, rname);
             }
             else
             {
-                TKLog::printf("A syntax error is found in %s. dennco-connect doesn't belong to any of dennco-cell.", path);
-            }
-        }
-        else if (eclass == "dennco-api")
-        {
-            DNXMLElement *te = element->outer;
-            while(te)
-            {
-                std::string teclass = te->getAttributeValue("class");
-                if (teclass == "dennco-classdef")
+                std::string message = std::string("Syntax error while parsing ").append(path).append(". parameter='").append(parameter).append("' isn't correct.");
+                TKLog::printf("%s", message.c_str());
+                if (dnGlobal()->updateErrorStatus(DNGlobal::ERROR))
                 {
-                    if (classElement && classElement == te)
-                    {
-                        classAPIElement = element;
-                    }
-                    else
-                    {
-                        TKLog::printf("A syntax error is found in %s. dennco-api isn't properly defined.",path);
-                    }
-                    
-                    break;
+                    dnGlobal()->setMessage1("Initialization failed");
+                    dnGlobal()->setMessage2(message);
                 }
-                te = te->outer;
-            }
-            if (!te)
-            {
-                TKLog::printf("A syntax error is found in %s. dennco-api doesn't belong to any of dennco-cell.", path);
             }
         }
-        
+
         //go to next element
         //
         if (element->inner)
@@ -272,59 +253,33 @@ void DNContainerBuilder::parseXHTML(const char *docRoot, const char *path)
                 {
                     element = element->outer;
                 }
+            } while(element && element->next == NULL && element != xml->getRoot());
+            
+            if (!element)
+                break;
+            element = element->next;
 
-                // the processed element was cell code class definition.
-                // define it now.
-                if (classElement && (element == NULL || element->depth <= classElement->depth))
+            if (defineDepth >= 0 && (element == NULL || element->depth <= defineDepth))
+            {
+                defineDepth = -1;
+                if (cellName.length()>0)
                 {
-                    std::string _cellCodeName = getFQNString(path,className.c_str());
-                    std::string _cellCodeAPIType = classAPIElement ? classAPIElement->text : "";
-                    std::string _cellCodeScript = classScriptElement ? classScriptElement->text : "";
-                    
-                    DEBUG_TRACE("\n===== Define cell code class ===== \nClass:%s\nAPI:%s\n%s\n", _cellCodeName.c_str(), _cellCodeAPIType.c_str(), _cellCodeScript.c_str());
-                    
-                    mContainer->createCellCode(_cellCodeName, _cellCodeAPIType, _cellCodeScript);
-                    
-                    
-                    classElement = NULL;
-                    classScriptElement = NULL;
-                    classAPIElement = NULL;
-                    className = "";
+                    addCell(path, cellName, cellCodeName, script);
+                    cellName = "";
+                    cellCodeName = "";
+                    script = "";
                 }
-            
-                // the processed element was cell definition.
-                // define it now.
-                if (cellElement && (element == NULL || element->depth <= cellElement->depth))
+                else
                 {
-                    //scriptless celldef                    
-                    std::string _cellName = cellName;
-                    std::string _cellNameFQN = getFQNString(path, cellName.c_str());
-                    std::string _cellCodeName = getFQNString(path, cellCodeClassName.c_str());
-                    std::string _cellScript = cellScriptElement->text;
-                    
-                    DEBUG_TRACE("\n===== Define cell ================ \nName:%s\nClass:%s\nStartup script:\n%s\n", _cellNameFQN.c_str(), _cellCodeName.c_str(),_cellScript.c_str());
-                    
-                    
-                    PendingCellDefinition *newCellDefine = new PendingCellDefinition();
-                    newCellDefine->location = path;
-                    newCellDefine->cellName = _cellName;
-                    newCellDefine->cellCodeName = _cellCodeName;
-                    newCellDefine->startupScript = _cellScript;
-                    
-                    mPendingCellDefinitions.push(newCellDefine);
-                    
-                    cellElement = NULL;
-                    cellScriptElement = NULL;
-                    cellName = "";
-                    cellCodeClassName = "";
+                    addCellCode(path, cellCodeName, cellAPIType, script);
+                    cellCodeName = "";
+                    cellAPIType = "";
+                    script = "";
                 }
-                
-            } while(element && !element->next && element != xml->getRoot());
-            
-            if (!element)
-                break;
-            element = element->next;
+            }
         }
     }
+    if (xml)
+        delete xml;
     
 }
index 3a85ffb..836ecc4 100644 (file)
@@ -21,7 +21,7 @@
 #define dennco_TKContainerBuilder_h
 
 #include <queue>
-
+#include <string>
 #include "TKLock.h"
 
 class TKContainer;
@@ -39,13 +39,17 @@ private:
     TKLock                              mLock;
     TKContainer                         *mContainer;
 
+    void addCell(const char *path, std::string name, std::string cellcode, std::string customScript);
+    void addCellCode(const char *path, std::string name, std::string type, std::string cellScript);
+    void addConnection(const char *path, std::string origine, std::string destination, std::string name);
+
     class PendingCellDefinition
     {
     public:
         std::string location;
         std::string cellName;
         std::string cellCodeName;
-        std::string startupScript;
+        std::string customScript;
     };
     
     class PendingCellConnection
index 2808e2b..cedcd9d 100644 (file)
@@ -31,6 +31,9 @@ public:
     
     DNFileList *next;
     DNFileList *prev;
+    std::string getFilePath() const { return filePath; }
+
+private:
     std::string filePath;
 };
 
index 13a4dcc..d4f14b6 100644 (file)
@@ -23,7 +23,9 @@
 #include "DNUtils.h"
 
 #include <string>
-#include <strings.h>
+#ifndef _MSC_VER
+    #include <strings.h>
+#endif
 #include <stdio.h>
 
 const unsigned int DNHTTPServer::HTTPDEFAULTPORT = 50000;
index 20e33ef..e9f9f77 100644 (file)
 #include "TKLog.h"
 #include "TKDebug.h"
 
-#include <strings.h>
-#include <stdlib.h>
+#ifndef _MSC_VER
+    #include <strings.h>
+    #include <stdlib.h>
+#endif
 
 void trimString(std::string& str)
 {
@@ -37,7 +39,6 @@ void trimString(std::string& str)
     str = str.substr(pos1 == std::string::npos ? 0 : pos1, 
                      pos2 == std::string::npos ? str.length() - 1 : pos2 - pos1 + 1);
 }
-
 std::string parseCellCodeForScriptEngine(std::string jname, std::string cellCode)
 {
 #ifdef DEBUG
@@ -503,62 +504,33 @@ std::string getFQNString(const char *location, const char *name)
 std::string getJSEscapeString(const char *cstring)
 {
     const char *c = cstring; 
-    int len = 0;
-    while(*c)
-    {
-        if (*c == '/') len++;
-        else if (*c == '_') len++;
-        else if (*c == '.') len++;
-        else if (*c == '#') len++;
-                 
-        c++;
-        len++;
-    }
-    char *buf = (char*)malloc(len);
-    char *result = buf;
-    
-    c = cstring; 
+    std::string result = "";
     while(*c)
     {
         if (*c == '/')
         {
-            *buf = '_';
-            buf++;
-            *buf = 's';
-            buf++;
+            result.append("_s");
         }
         else if (*c == '_')
         {
-            *buf = '_';
-            buf++;
-            *buf = '_';
-            buf++;            
+            result.append("__");
         }
         else if (*c == '.')
         {
-            *buf = '_';
-            buf++;
-            *buf = 'd';
-            buf++;
+            result.append("_d");
         }
         else if (*c == '#')
         {
-            *buf = '_';
-            buf++;
-            *buf = 'S';
-            buf++;
+            result.append("_S");
         }
         else
         {
-            *buf = *c;
-            buf++;
+            result.append(1,*c);
         }
         
         c++;
-        len++;
     }
-    *buf = 0;
-    
-    return std::string(result);
+
+    return result;
 }
 
index ab9e80f..8751689 100644 (file)
@@ -30,6 +30,8 @@ DNXMLElement::~DNXMLElement()
     while (e && e != this && depth <= e->depth)
     {
         while(e->inner) e = e->inner;
+        if (e->outer)
+            e->outer->inner = e->next;
         DNXMLElement *ne = e->next ? e->next : e->outer;
         delete e;
         e = ne;
index b1c941a..6b175da 100644 (file)
@@ -28,7 +28,7 @@
 class DNQSBasicCell : public DNQSCellBase, QObject
 {
 public:
-    DNQSBasicCell(DNQSContainer *container, std::string location, std::string name, bool canIntarface = true);
+    DNQSBasicCell(DNQSContainer *container, std::string location, std::string name, bool canIntarface = false);
     virtual ~DNQSBasicCell();
 
     virtual bool            doTick(float time);
index 62bde83..d769168 100644 (file)
@@ -40,15 +40,8 @@ DNQSCellCodeInstance::DNQSCellCodeInstance(TKCell *owner, QScriptValue qsObject)
     mQSCellContainer.setProperty(mInstanceTag, qsObject);
 
     mQSDoTick = qsObject.property("doTick");
-    if (mQSDoTick.isFunction())
-    {
-        mIsValid = true;
-    }
-    else
-    {
-        mIsValid = false;
-        TKLog::printf("JS Syntax error. can't find mandatory method doTick.." );
-    }
+    mHasDoTick = mQSDoTick.isFunction();
+
     mQSDoInit = qsObject.property("doInit");
     mQSDoDestroy = qsObject.property("doDestroy");
 
@@ -66,7 +59,7 @@ DNQSCellCodeInstance::~DNQSCellCodeInstance()
 
 bool DNQSCellCodeInstance::doTick(float time)
 {
-    if (mIsValid)
+    if (mHasDoTick)
     {
         QScriptValueList args;
         args << time;
index f7a0471..f984871 100644 (file)
@@ -46,6 +46,7 @@ private:
     QScriptValue    mQSCellCodeInstance;
     QScriptValue    mQSDoInit;
     QScriptValue    mQSDoTick;
+    bool            mHasDoTick;
     QScriptValue    mQSDoDestroy;
     bool            mIsValid;
 
index 135a6e1..9a4fa27 100644 (file)
 #include "dnqsbasiccell.h"
 #include "TKUICell.h"
 #include "dnqscellcode.h"
+#include "DNGlobal.h"
 
-const std::string DNQSContainer::CELLTYPE_JSBASIC = "TKJSBasicCell";
-const std::string DNQSContainer::CELLTYPE_UIBASE = "TKUIBaseCell";
+const std::string DNQSContainer::CELLTYPE_JSBASIC = "B";
+const std::string DNQSContainer::CELLTYPE_UIBASIC = "UB";
 
 static QScriptValue scriptPrint(QScriptContext *context, QScriptEngine *engine)
 {
@@ -92,21 +93,22 @@ TKCell* DNQSContainer::createCell(std::string theLocation, std::string theName,
 
     if (type == CELLTYPE_JSBASIC)
     {
-        DNQSBasicCell *basicCell = new DNQSBasicCell(this, theLocation, theName);
-        if (basicCell)
-        {
-            //do some init here if needed.
-
-            cell = basicCell;
-        }
+        cell = new DNQSBasicCell(this, theLocation, theName, false);
     }
-    else if (type == CELLTYPE_UIBASE)
+    else if (type == CELLTYPE_UIBASIC)
     {
-        cell = new TKUICell(this, theLocation, theName);
+        cell = new DNQSBasicCell(this, theLocation, theName, true);
     }
     else
     {
-        TKLog::printf("ERROR in TKJSContainer::createCell. Type name:%s is not correct.", type.c_str());
+        std::string message = std::string("Failed to construct cell '").append(theLocation).append("#").append(theName);
+        message.append("'\nThe cellcode requires type '").append(type).append("' but it's not a supported type.");
+        TKLog::printf("%s", message.c_str());
+        if (dnGlobal()->updateErrorStatus(DNGlobal::ERROR))
+        {
+            dnGlobal()->setMessage1("Initialization failed");
+            dnGlobal()->setMessage2(message);
+        }
     }
 
 
index 54ddc40..ea73dea 100644 (file)
@@ -43,7 +43,7 @@ public:
     inline QScriptValue     getQSCellContainer() { return mQSCellContainer; }
 
     static const std::string CELLTYPE_JSBASIC;
-    static const std::string CELLTYPE_UIBASE;
+    static const std::string CELLTYPE_UIBASIC;
 
  private:
     QScriptEngine   *mQSEngine;
index 476a7b8..c2de645 100644 (file)
@@ -30,7 +30,7 @@ public:
        void    setTarget(TKReceptor *theReceptor) {mTarget = theReceptor;}
     void    release(TKReceptor *receptor);
     
-    bool    isConnected() { return mTarget; }
+    bool    isConnected() { return mTarget != 0; }
     TKAxon* getOwner() { return mOwner; }
     float   getValue();
        
@@ -40,4 +40,4 @@ private:
 
 };
 
-#endif
\ No newline at end of file
+#endif
index be7c36a..31fd67c 100644 (file)
 #endif
 
 #ifdef DEBUG
-    #define TKASSERT(b) { if (!b) {TKLog::debugPrintf("ASSERT ERROR! %s(%d)",__PRETTY_FUNCTION__, __LINE__);/*TODO*/}}
+    #if defined(_MSC_VER)
+        #define TKASSERT(b) { if (!b) {TKLog::debugPrintf("ASSERT ERROR! %s(%d)",__FUNCTION__, __LINE__);/*TODO*/}}
+    #else
+        #define TKASSERT(b) { if (!b) {TKLog::debugPrintf("ASSERT ERROR! %s(%d)",__PRETTY_FUNCTION__, __LINE__);/*TODO*/}}
+    #endif
 #else
     #define TKASSERT(b)
 #endif
index 953efa3..517ec22 100644 (file)
@@ -64,6 +64,7 @@ const DNFileList* QtDNDirectoryImpl::getFileList(const char *filter)
          if (prev)
          {
              prev->next = dnfile;
+             dnfile->prev = prev;
              prev = dnfile;
          }
          else
@@ -75,7 +76,6 @@ const DNFileList* QtDNDirectoryImpl::getFileList(const char *filter)
 
      return mFileList;
 }
-
 void QtDNDirectoryImpl::cleanFileList()
 {
     DNFileList *file = mFileList;
@@ -83,6 +83,7 @@ void QtDNDirectoryImpl::cleanFileList()
     while(file)
     {
         DNFileList *next = file->next;
+        if (next) next->prev = 0;
         delete file;
         file = next;
     }