fixing core crash during restore
authorMarcus Eggenberger <egs@quassel-irc.org>
Thu, 26 Jun 2008 11:57:57 +0000 (13:57 +0200)
committerMarcus Eggenberger <egs@quassel-irc.org>
Thu, 26 Jun 2008 11:58:15 +0000 (13:58 +0200)
CMakeLists.txt
src/core/networkconnection.cpp

index 9baf21a..3f074e8 100644 (file)
@@ -54,6 +54,11 @@ endif(CMAKE_COMPILER_IS_GNUCXX)
 
 set(QT_MIN_VERSION "4.3.0")
 
+if(APPLE)
+  set(CMAKE_OSX_ARCHITECTURES "i386;ppc")
+#  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.4")
+endif(APPLE)
+
 # Enable mostly b0rked stuff (new ChatView), do not enable this unless you know what you do...
 if(SPUTDEV)
   add_definitions(-DSPUTDEV)
@@ -78,6 +83,10 @@ include_directories(${QT_INCLUDES})
 # We need to create a version.gen
 # For this, we create our genversion binary and make sure it is run every time.
 add_executable(genversion ${CMAKE_SOURCE_DIR}/src/common/genversion.cpp)
+#set_target_properties(genversion PROPERTIES 
+#                                 LINK_FLAGS "-mmacosx-version-min=10.4")
+#                                 COMPILE_FLAGS "-mmacosx-version-min=10.4"
+
 target_link_libraries(genversion ${QT_LIBRARIES} ${QT_CORE_LIB_DEPENDENCIES})
 
 add_custom_target(genversion_run ALL ${CMAKE_BINARY_DIR}/genversion
index 4ded4a8..f5e6a36 100644 (file)
@@ -436,7 +436,10 @@ int NetworkConnection::lastParamOverrun(const QString &cmd, const QList<QByteArr
   // that means that the last message can be as long as:
   // 512 - nicklen - userlen - hostlen - commandlen - sum(param[0]..param[n-1])) - 2 (for CRLF) - 4 (":!@" + 1space between prefix and command) - max(paramcount - 1, 0) (space for simple params) - 2 (space and colon for last param)
   IrcUser *me = network()->me();
-  int maxLen = 512 - serverEncode(me->nick()).count() - serverEncode(me->user()).count() - serverEncode(me->host()).count() - cmd.toAscii().count() - 6;
+  int maxLen = 480 - cmd.toAscii().count(); // educated guess in case we don't know us (yet?)
+
+  if(me)
+    maxLen = 512 - serverEncode(me->nick()).count() - serverEncode(me->user()).count() - serverEncode(me->host()).count() - cmd.toAscii().count() - 6;
 
   if(!params.isEmpty()) {
     for(int i = 0; i < params.count() - 1; i++) {