[Kde-perl] perlQt Network problem

Arnaud DUPUIS a.dupuis at infinityperl.org
Wed Dec 21 10:23:39 CET 2005


Hello all,
I'm afraid that my problem i not only with KDE-perl but with perlQt... Sorry 
to disturb you.
I'm coding an application wich use network, so I use the Qt::Socket class, and 
because of the application design I have create a "Network manager" (a little 
like the mozilla download manager), this manager is call 
operationsProcessor(.pm), and it use another class : 
operationProcessorNetWidget(.pm).
The purpose of this second class is to handle one connection to the remote 
daemon (and the operationsProcessor handle all operations about 
operationProcessorNetWidget, it's stairs like : one class is a wrapper for 
the other).
And I've got a really weird problem that I don't understand :
In the operationsProcessor class I have a line something like that :
$net->{$text} = slackget10::GUI::Qt::operationProcessorNetWidget($widget);

where $ent is a hashref, $text the text receive (like '192.168.0.10:42000'), 
and $widget a container to include the new operationProcessorNetWidget 
instance in a tabwidget.
When I try to connect this widget to 2 rremote daemons I get the following 
trace :

STDOUT> [DEBUG::operationProcessorNetWidget] object 
slackget10::GUI::Qt::operationProcessorNetWidget=HASH(0x888d508) create 
connection to host 192.168.0.10 on port 42000 
STDOUT> [DEBUG::operationProcessorNetWidget] object 
slackget10::GUI::Qt::operationProcessorNetWidget=HASH(0x88aa4e4) create 
connection to host 192.168.0.20 on port 42000 
STDOUT> [DEBUG::operationProcessorNetWidget] 
slackget10::GUI::Qt::operationProcessorNetWidget=HASH(0x88aa4e4) (socket 
addr : 192.168.0.10) emit signal connectionClosed("192.168.0.20:42000") 
STDOUT> [DEBUG::operationProcessorNetWidget] 
slackget10::GUI::Qt::operationProcessorNetWidget=HASH(0x888d508) (socket 
addr : 192.168.0.10) emit signal connectionClosed("192.168.0.20:42000") 

As you can see the 2 widgets have differents references but they share their 
data ! And, of course, I dont want to do that. The most weird is that the two 
first lines are from the slot who create the new connections, and you can see 
that he receive good data. But after the problem occur :
the string " (socket addr : 192.168.0.10)" is build by calling "socket addr : 
",sg_socket->address()->toString() where sg_socket is a Qt::attribute 
instanciate into a Qt::Socket.
The string emit signal connectionClosed("192.168.0.20:42000") is built by 
calling print "[...]emit signal connectionClosed("$server:$port")\n"; where 
$server and $port are perl variables declare as "my" at the top of the 
operationProcessorNetWidget class.

If somebody can help me I will be really gratefull ! I'm searching why both of 
variables and Qt::attributes are shared (maybe because of some obscur 
threads) and I can't figure a way to correct this problem.

Good day.

-- 


DUPUIS Arnaud

[ Infinity Perl ]
http://slackget.infinityperl.org

"Slackware : because it works"
=========================
gpg id : 0xAC37E1B0
=========================


More information about the Kde-perl mailing list