Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
hiredis
Commits
4a632a60
Commit
4a632a60
authored
Oct 02, 2014
by
Pietro Cerutti
Committed by
Jan-Erik Rediger
Jul 27, 2015
Browse files
Make sure to disconnect the adapter in the destructor
parent
9069b147
Changes
2
Hide whitespace changes
Inline
Side-by-side
adapters/qt.h
View file @
4a632a60
/*-
/*-
* Copyright (C) 2014 Pietro Cerutti <gahr@gahr.ch>
* Copyright (C) 2014 Pietro Cerutti <gahr@gahr.ch>
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* modification, are permitted provided that the following conditions
* are met:
* are met:
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* documentation and/or other materials provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
...
@@ -69,12 +69,19 @@ class RedisQtAdapter : public QObject {
...
@@ -69,12 +69,19 @@ class RedisQtAdapter : public QObject {
}
}
public:
public:
RedisQtAdapter
(
QObject
*
parent
=
0
)
RedisQtAdapter
(
QObject
*
parent
=
0
)
:
QObject
(
parent
),
m_ctx
(
0
),
m_read
(
0
),
m_write
(
0
)
{
}
:
QObject
(
parent
),
m_ctx
(
0
),
m_read
(
0
),
m_write
(
0
)
{
}
~
RedisQtAdapter
()
{
}
~
RedisQtAdapter
()
{
if
(
m_ctx
!=
0
)
{
m_ctx
->
ev
.
data
=
NULL
;
}
}
void
setContext
(
redisAsyncContext
*
ac
)
{
int
setContext
(
redisAsyncContext
*
ac
)
{
if
(
ac
->
ev
.
data
!=
NULL
)
{
return
REDIS_ERR
;
}
m_ctx
=
ac
;
m_ctx
=
ac
;
m_ctx
->
ev
.
data
=
this
;
m_ctx
->
ev
.
data
=
this
;
m_ctx
->
ev
.
addRead
=
RedisQtAddRead
;
m_ctx
->
ev
.
addRead
=
RedisQtAddRead
;
...
@@ -82,6 +89,7 @@ class RedisQtAdapter : public QObject {
...
@@ -82,6 +89,7 @@ class RedisQtAdapter : public QObject {
m_ctx
->
ev
.
addWrite
=
RedisQtAddWrite
;
m_ctx
->
ev
.
addWrite
=
RedisQtAddWrite
;
m_ctx
->
ev
.
delWrite
=
RedisQtDelWrite
;
m_ctx
->
ev
.
delWrite
=
RedisQtDelWrite
;
m_ctx
->
ev
.
cleanup
=
RedisQtCleanup
;
m_ctx
->
ev
.
cleanup
=
RedisQtCleanup
;
return
REDIS_OK
;
}
}
private:
private:
...
...
examples/example-qt.h
View file @
4a632a60
...
@@ -13,7 +13,7 @@ class ExampleQt : public QObject {
...
@@ -13,7 +13,7 @@ class ExampleQt : public QObject {
signals:
signals:
void
finished
();
void
finished
();
public
slots
:
public
slots
:
void
run
();
void
run
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment