-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[qt5cpp] delete callback data allocated before signal emission (#7840)
* Small fixes to prevent crash when empty json body is provided. * Add deleteLater wrapper for pointers passed to user code to prevent memory leak. * Updates to move Object Wrapper to separate file * Add Prefix to class name
- Loading branch information
1 parent
d185009
commit 3b031ed
Showing
10 changed files
with
109 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
modules/swagger-codegen/src/main/resources/qt5cpp/QObjectWrapper.h.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{{>licenseInfo}} | ||
#ifndef {{prefix}}_QOBJECT_WRAPPER_H | ||
#define {{prefix}}_QOBJECT_WRAPPER_H | ||
|
||
#include <QObject> | ||
|
||
{{#cppNamespaceDeclarations}} | ||
namespace {{this}} { | ||
{{/cppNamespaceDeclarations}} | ||
|
||
template <typename ObjectPtrT> | ||
class {{prefix}}QObjectWrapper : public QObject { | ||
public: | ||
{{prefix}}QObjectWrapper(ObjectPtrT ptr){ | ||
data = ptr; | ||
} | ||
~{{prefix}}QObjectWrapper(){ | ||
delete data; | ||
} | ||
private : | ||
ObjectPtrT data; | ||
}; | ||
|
||
{{#cppNamespaceDeclarations}} | ||
} | ||
{{/cppNamespaceDeclarations}} | ||
|
||
#endif // {{prefix}}_QOBJECT_WRAPPER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* Swagger Petstore | ||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. | ||
* | ||
* OpenAPI spec version: 1.0.0 | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by the swagger code generator program. | ||
* https://github.com/swagger-api/swagger-codegen.git | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
#ifndef SWG_QOBJECT_WRAPPER_H | ||
#define SWG_QOBJECT_WRAPPER_H | ||
|
||
#include <QObject> | ||
|
||
namespace Swagger { | ||
|
||
template <typename ObjectPtrT> | ||
class SWGQObjectWrapper : public QObject { | ||
public: | ||
SWGQObjectWrapper(ObjectPtrT ptr){ | ||
data = ptr; | ||
} | ||
~SWGQObjectWrapper(){ | ||
delete data; | ||
} | ||
private : | ||
ObjectPtrT data; | ||
}; | ||
|
||
} | ||
|
||
#endif // SWG_QOBJECT_WRAPPER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters