diff --git a/src/main.cpp b/src/main.cpp index 6b82fc592..537e077ba 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -168,6 +168,13 @@ void useStyle(QApplication *app, QString style){ // Main int main(int argc, char *argv[]){ + // Create Application + #ifdef DISABLE_GUI + app = new QCoreApplication(argc, argv); + #else + app = new QApplication(argc, argv); + #endif + QString locale; QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); #ifndef DISABLE_GUI @@ -208,16 +215,10 @@ int main(int argc, char *argv[]){ std::cout << "disconnected\n"; } localSocket.close(); + delete app; return 0; } - // Create Application -#ifdef DISABLE_GUI - app = new QCoreApplication(argc, argv); -#else - app = new QApplication(argc, argv); -#endif - // Load translation locale = settings.value(QString::fromUtf8("Preferences/General/Locale"), QString()).toString(); QTranslator translator; @@ -341,7 +342,10 @@ int main(int argc, char *argv[]){ delete loader; #endif qDebug("Deleting app..."); +#ifndef Q_WS_WIN + // XXX: Why does it crash on Windows!? delete app; +#endif qDebug("App was deleted! All good."); return ret; } diff --git a/src/misc.cpp b/src/misc.cpp index e554a0a3a..96818a2a6 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -74,6 +74,7 @@ QString misc::QDesktopServicesDataLocation() { result = QString::fromWCharArray(path); if (!QCoreApplication::applicationName().isEmpty()) result = result + QLatin1String("\\") + qApp->applicationName(); + return result; #else #ifdef Q_WS_MAC // http://developer.apple.com/documentation/Carbon/Reference/Folder_Manager/Reference/reference.html @@ -300,7 +301,7 @@ QString misc::BTBackupLocation() { } QString misc::cacheLocation() { - const QString &location = QDir::cleanPath(QDesktopServicesCacheLocation()); + QString location = QDir::cleanPath(QDesktopServicesCacheLocation()); QDir locationDir(location); if(!locationDir.exists()) locationDir.mkpath(locationDir.absolutePath()); diff --git a/src/src.pro b/src/src.pro index 914a3bf40..33928c7b0 100644 --- a/src/src.pro +++ b/src/src.pro @@ -3,7 +3,7 @@ LANG_PATH = lang ICONS_PATH = Icons # Set the following variable to 1 to enable debug -DEBUG_MODE = 0 +DEBUG_MODE = 1 # Global TEMPLATE = app @@ -22,7 +22,7 @@ DEFINES += VERSION_BUGFIX=8 win32 { # Adapt these paths on Windows - INCLUDEPATH += $$quote(C:/qbittorrent/boost_1_40_0) + INCLUDEPATH += $$quote(C:/qbittorrent/boost_1_42_0) INCLUDEPATH += $$quote(C:/qbittorrent/libtorrent-rasterbar-0.14.10/include) INCLUDEPATH += $$quote(C:/qbittorrent/libtorrent-rasterbar-0.14.10/zlib) @@ -133,27 +133,27 @@ DEFINES += QT_USE_FAST_CONCATENATION QT_USE_FAST_OPERATOR_PLUS # win32:LIBS += -ltorrent -lboost_system # win32:LIBS += -lz ? win32 { - LIBS += -lssleay32 \ - -leay32 \ - -lws2_32 \ - -lwsock32 \ - -ladvapi32 \ - -lwinmm # Adapt these paths on Windows LIBS += C:/qbittorrent/libs/libtorrent.lib \ - C:/qbittorrent/libs/libboost_system.lib \ - C:/qbittorrent/libs/libboost_filesystem.lib \ - C:/qbittorrent/libs/libboost_thread.lib \ - C:/Qt/2010.02.1/mingw/lib/*.a \ - C:/Qt/2010.02.1/mingw/lib/libssleay32.a \ - C:/Qt/2010.02.1/mingw/lib/libeay32.a \ - C:/Qt/2010.02.1/mingw/lib/libws2_32.a \ + C:/qbittorrent/libs/libboost_system-mgw44-mt-s.lib \ + C:/qbittorrent/libs/libboost_filesystem-mgw44-mt-s.lib \ + C:/qbittorrent/libs/libboost_thread-mgw44-mt-s.lib \ + C:/OpenSSL/lib/MinGW/ssleay32.a \ + C:/OpenSSL/lib/MinGW/libeay32.a \ C:/Qt/2010.02.1/mingw/lib/libwsock32.a \ - C:/Qt/2010.02.1/mingw/lib/libadvapi32.a \ - C:/Qt/2010.02.1/mingw/lib/libwinmm.a \ - C:/Qt/2010.02.1/mingw/lib/libgdi32.a \ - -LC:/Qt/2010.02.1/mingw/lib/ + C:/Qt/2010.02.1/mingw/lib/libws2_32.a #\ +# -LC:/Qt/2010.02.1/mingw/lib/ +# C:/Qt/2010.02.1/mingw/lib/libadvapi32.a \ +# C:/Qt/2010.02.1/mingw/lib/libwinmm.a \ +# C:/Qt/2010.02.1/mingw/lib/libgdi32.a \ + +# LIBS += -lssleay32 \ +# -leay32 \ +# -lws2_32 \ +# -lwsock32 \ +# -ladvapi32 \ +# -lwinmm } os2:LIBS += -ltorrent-rasterbar \