View Issue Details

IDProjectCategoryView StatusLast Update
0038844LazarusWidgetsetpublic2021-05-07 23:22
ReporterBenjamin Rosseaux Assigned ToZeljan Rikalo  
PrioritynormalSeveritycrashReproducibilityalways
Status assignedResolutionopen 
Platformx86_64OSWindows 
Product Version2.0.13 (SVN) 
Summary0038844: Patches to Qt5Pas / LCLQt5 for crash-free Win64 Support at application startup when more complex widgets are used
Description
I've quasi-IFDEF-ed the Qt5 network etc. stuff in the Qt5Pas.pro for the Windows targets, because it crashs at least Win64 LCLQt5 applications, when they are using more enhanced LCL widget components as such as TOpenDialog, TSaveDialog, TShellTreeView, TTreeView, etc. There are only working under the Win64 target when the Qt5 network stuff isn't compiled in inside the Qt5Pas1.dll. And I've commented "QMAKE_CXXFLAGS += -Wfatal-errors" out, because it doesn't compile to me. (And it seems that the DoubleCommander does patching it also out for their Win64 build, possibly due to similiar problems)

I've added a patch to this issue to fix this.

And in this Qt5Pas I've added QPixMapCache_Clear for to clear the style pixmap cache (see https://stackoverflow.com/a/48023351/371322 ) after applying a new application color palette.

And I've changed the PTRINT ad PTRUINT to the new standard intptr_t and uintptr_t types from cstdint / stdint.h in order to make it more standard complaint C++.

And I've changed "#if defined(__WIN32__)" to "#if defined(WIN32) || defined(__WIN32) || defined(__WIN32__)" for to support MSVC in a better way.

I think, this should be all, what I've changed or added.
TagsNo tags attached.
Fixed in Revision
LazTarget
WidgetsetWin32/Win64, QT5
Attached Files

Activities

Benjamin Rosseaux

2021-05-02 23:50

reporter  

Qt5Pas.patch (9,814 bytes)   
Index: cbindings/Qt5Pas.pro
===================================================================
--- cbindings/Qt5Pas.pro	(revision 65079)
+++ cbindings/Qt5Pas.pro	(working copy)
@@ -15,14 +15,20 @@
 
 VERSION = 1.2.9
 
-QT += gui network printsupport
+QT += gui printsupport
+!win32 {
+  # On windows the QT5 network stuff does make problems, so add it only on non-windows targets  
+  QT += network
+}
 TARGET = Qt5Pas
 TEMPLATE = lib
 VPATH = src
 MOC_DIR = tmp
 OBJECTS_DIR = tmp
-QMAKE_CXXFLAGS += -Wfatal-errors
 
+# Make it compile even with warnings, so commented out 
+# QMAKE_CXXFLAGS += -Wfatal-errors
+
 # Match Intel x86_64 i686 i586 i386 x86 ...
 is86 = $$find(QMAKE_HOST.arch, ".*86")
 # Match 64 bit
@@ -212,6 +218,7 @@
            qtextdocumentwriter_c.h \
            qicon_c.h \
            qpixmap_c.h \
+           qpixmapcache_c.h \
            qimage_c.h \
            qbitmap_c.h \
            qpicture_c.h \
@@ -353,27 +360,6 @@
            qgraphicsscene_c.h \
            qgraphicsscene_hook.h \
            qgraphicsview_c.h \
-           qsslcipher_c.h \
-           qsslkey_c.h \
-           qsslerror_c.h \
-           qabstractsocket_c.h \
-           qabstractsocket_hook.h \
-           qudpsocket_c.h \
-           qudpsocket_hook.h \
-           qtcpsocket_c.h \
-           qtcpsocket_hook.h \
-           qtcpserver_c.h \
-           qtcpserver_hook.h \
-           qsslconfiguration_c.h \
-           qsslsocket_c.h \
-           qnetworkaccessmanager_c.h \
-           qnetworkaccessmanager_hook.h \
-           qnetworkrequest_c.h \
-           qnetworkreply_c.h \
-           qnetworkreply_hook.h \
-           qnetworkcookiejar_c.h \
-           qnetworkproxy_c.h \
-           qauthenticator_c.h \
            qcoreapplication_hook_c.h \
            qtimer_hook_c.h \
            qsocketnotifier_hook_c.h \
@@ -451,13 +437,8 @@
            qprintpreviewdialog_hook_c.h \
            qprintpreviewwidget_hook_c.h \
            qsystemtrayicon_hook_c.h \
-           qgraphicsscene_hook_c.h \
-           qabstractsocket_hook_c.h \
-           qudpsocket_hook_c.h \
-           qtcpsocket_hook_c.h \
-           qtcpserver_hook_c.h \
-           qnetworkaccessmanager_hook_c.h \
-           qnetworkreply_hook_c.h 
+           qgraphicsscene_hook_c.h
+
 SOURCES +=  \
            qobject_hook_c.cpp \
            pascalbind.cpp \
@@ -556,6 +537,7 @@
            qtextdocumentwriter_c.cpp \
            qicon_c.cpp \
            qpixmap_c.cpp \
+           qpixmapcache_c.cpp \
            qimage_c.cpp \
            qbitmap_c.cpp \
            qpicture_c.cpp \
@@ -642,21 +624,6 @@
            qstylefactory_c.cpp \
            qgraphicsscene_c.cpp \
            qgraphicsview_c.cpp \
-           qsslcipher_c.cpp \
-           qsslkey_c.cpp \
-           qsslerror_c.cpp \
-           qabstractsocket_c.cpp \
-           qudpsocket_c.cpp \
-           qtcpsocket_c.cpp \
-           qtcpserver_c.cpp \
-           qsslconfiguration_c.cpp \
-           qsslsocket_c.cpp \
-           qnetworkaccessmanager_c.cpp \
-           qnetworkrequest_c.cpp \
-           qnetworkreply_c.cpp \
-           qnetworkcookiejar_c.cpp \
-           qnetworkproxy_c.cpp \
-           qauthenticator_c.cpp \
            qcoreapplication_hook_c.cpp \
            qtimer_hook_c.cpp \
            qsocketnotifier_hook_c.cpp \
@@ -734,11 +701,59 @@
            qprintpreviewdialog_hook_c.cpp \
            qprintpreviewwidget_hook_c.cpp \
            qsystemtrayicon_hook_c.cpp \
-           qgraphicsscene_hook_c.cpp \
+           qgraphicsscene_hook_c.cpp
+
+!win32{
+  HEADERS += \
+           qsslcipher_c.h \
+           qsslkey_c.h \
+           qsslerror_c.h \
+           qabstractsocket_c.h \
+           qabstractsocket_hook.h \
+           qudpsocket_c.h \
+           qudpsocket_hook.h \
+           qtcpsocket_c.h \
+           qtcpsocket_hook.h \
+           qtcpserver_c.h \
+           qtcpserver_hook.h \
+           qsslconfiguration_c.h \
+           qsslsocket_c.h \
+           qnetworkaccessmanager_c.h \
+           qnetworkaccessmanager_hook.h \
+           qnetworkrequest_c.h \
+           qnetworkreply_c.h \
+           qnetworkreply_hook.h \
+           qnetworkcookiejar_c.h \
+           qnetworkproxy_c.h \
+           qauthenticator_c.h \
+           qabstractsocket_hook_c.h \
+           qudpsocket_hook_c.h \
+           qtcpsocket_hook_c.h \
+           qtcpserver_hook_c.h \
+           qnetworkaccessmanager_hook_c.h \
+           qnetworkreply_hook_c.h              
+  SOURCES += \
+           qsslcipher_c.cpp \
+           qsslkey_c.cpp \
+           qsslerror_c.cpp \
+           qabstractsocket_c.cpp \
+           qudpsocket_c.cpp \
+           qtcpsocket_c.cpp \
+           qtcpserver_c.cpp \
+           qsslconfiguration_c.cpp \
+           qsslsocket_c.cpp \
+           qnetworkaccessmanager_c.cpp \
+           qnetworkrequest_c.cpp \
+           qnetworkreply_c.cpp \
+           qnetworkcookiejar_c.cpp \
+           qnetworkproxy_c.cpp \
+           qauthenticator_c.cpp \
            qabstractsocket_hook_c.cpp \
            qudpsocket_hook_c.cpp \
            qtcpsocket_hook_c.cpp \
            qtcpserver_hook_c.cpp \
            qnetworkaccessmanager_hook_c.cpp \
-           qnetworkreply_hook_c.cpp
+           qnetworkreply_hook_c.cpp             
+}
+
 # end of file
Index: cbindings/src/chandles.h
===================================================================
--- cbindings/src/chandles.h	(revision 65079)
+++ cbindings/src/chandles.h	(working copy)
@@ -13,14 +13,11 @@
 #ifndef CHANDLES_H
 #define CHANDLES_H
 
-#if defined _LP64
-typedef long long int PTRINT;
-typedef unsigned long long int PTRUINT;
-#else
-typedef int PTRINT;
-typedef unsigned int PTRUINT;
-#endif
+#include <stdint.h>
 
+typedef intptr_t PTRINT;
+typedef uintptr_t PTRUINT;
+
 typedef struct QAbstractButton__ { PTRINT dummy; } *QAbstractButtonH;
 typedef struct QSizePolicy__ { PTRINT dummy; } *QSizePolicyH;
 typedef struct QSurface__ { PTRINT dummy; } *QSurfaceH;
Index: cbindings/src/pascalbind.h
===================================================================
--- cbindings/src/pascalbind.h	(revision 65079)
+++ cbindings/src/pascalbind.h	(working copy)
@@ -26,14 +26,14 @@
 
 #include "chandles.h"
 
-
-#if defined(__WIN32__)
+#if defined(WIN32) || defined(__WIN32) || defined(__WIN32__)
+#define __WIN32__
 #define C_EXPORT extern "C" __declspec( dllexport )
 #else
 #define C_EXPORT extern "C"
 #endif
 
-#ifdef __WIN32__
+#if defined(WIN32) || defined(__WIN32) || defined(__WIN32__)
 #include <windows.h>
 #endif
 
@@ -40,13 +40,8 @@
 typedef bool (*EventFilter)(void *message, long *result);
 typedef bool (*EventFilter2)(void *message);
 
-#if defined _LP64
-typedef long long int PTRINT;
-typedef unsigned long long int PTRUINT;
-#else
-typedef int PTRINT;
-typedef unsigned int PTRUINT;
-#endif
+typedef intptr_t PTRINT;
+typedef uintptr_t PTRUINT;
 
 
 typedef uint WFlags;
Index: cbindings/src/qpixmapcache_c.cpp
===================================================================
--- cbindings/src/qpixmapcache_c.cpp	(nonexistent)
+++ cbindings/src/qpixmapcache_c.cpp	(working copy)
@@ -0,0 +1,16 @@
+//******************************************************************************
+//  Copyright (c) 2005-2013 by Jan Van hijfte
+//
+//  See the included file COPYING.TXT for details about the copyright.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+//******************************************************************************
+
+#include "qpixmapcache_c.h"
+
+void QPixmapCache_Clear()
+{
+	QPixmapCache::clear();
+}
Index: cbindings/src/qpixmapcache_c.h
===================================================================
--- cbindings/src/qpixmapcache_c.h	(nonexistent)
+++ cbindings/src/qpixmapcache_c.h	(working copy)
@@ -0,0 +1,20 @@
+//******************************************************************************
+//  Copyright (c) 2005-2013 by Jan Van hijfte
+//
+//  See the included file COPYING.TXT for details about the copyright.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+//******************************************************************************
+
+
+#ifndef QPIXMAP_C_H
+#define QPIXMAP_C_H
+
+#include <QtGui>
+#include "pascalbind.h"
+
+C_EXPORT void QPixmapCache_Clear();
+
+#endif
Index: qt56.pas
===================================================================
--- qt56.pas	(revision 65079)
+++ qt56.pas	(working copy)
@@ -8959,8 +8959,10 @@
 procedure QIcon_themeName(retval: PWideString); cdecl; external Qt5PasLib name 'QIcon_themeName';
 procedure QIcon_setThemeName(path: PWideString); cdecl; external Qt5PasLib name 'QIcon_setThemeName';
 
+procedure QPixmapCache_Clear(); cdecl; external Qt5PasLib name 'QPixmapCache_Clear';
+
 function QPixmap_Create(): QPixmapH; cdecl; external Qt5PasLib name 'QPixmap_Create';
-procedure QPixmap_Destroy(handle: QPixmapH); cdecl; external Qt5PasLib name 'QPixmap_Destroy'; 
+procedure QPixmap_Destroy(handle: QPixmapH); cdecl; external Qt5PasLib name 'QPixmap_Destroy';
 function QPixmap_Create(w: Integer; h: Integer): QPixmapH; cdecl; external Qt5PasLib name 'QPixmap_Create2';
 function QPixmap_Create(AnonParam1: PSize): QPixmapH; cdecl; external Qt5PasLib name 'QPixmap_Create3';
 function QPixmap_Create(fileName: PWideString; format: PAnsiChar = nil; flags: QtImageConversionFlags = QtAutoColor): QPixmapH; cdecl; external Qt5PasLib name 'QPixmap_Create4';
Qt5Pas.patch (9,814 bytes)   

Issue History

Date Modified Username Field Change
2021-05-02 23:50 Benjamin Rosseaux New Issue
2021-05-02 23:50 Benjamin Rosseaux File Added: Qt5Pas.patch
2021-05-07 23:22 Zeljan Rikalo Assigned To => Zeljan Rikalo
2021-05-07 23:22 Zeljan Rikalo Status new => assigned