Errors in new Giomm-API



Hi,

when i compile a simple program like this:

   int main(int argc, char** argv)
   {
       Glib::init();
       Gio::init();

       Glib::RefPtr<Gio::SocketClient> client =
   Gio::SocketClient::create();
       Glib::RefPtr<Gio::SocketConnection> con =
   client->connect_to_host("google.at", 80);

       Glib::RefPtr<Gio::OutputStream> out = con->get_output_stream();
       out->write(    "GET / HTTP/1.1\r\n"
                   "Host: www.google.at\r\n\r\n");

       Glib::RefPtr<Gio::InputStream> in = con->get_input_stream();

       char buffer[1024];
       int read = in->read(buffer, 1024);
       buffer[read] = 0;

       out->close();  //This lines avoid more errors like
       in->close();    //GLib-GIO-CRITICAL **: g_output_stream_close:
       con->close(); //  assertion `G_IS_OUTPUT_STREAM (stream)' failed

       return 0;
   }

the program compiles, works but prints Glib-Errors

   (process:3042): GLib-GObject-CRITICAL **: g_object_unref: assertion
   `G_IS_OBJECT (object)' failed
   (process:3042): GLib-GObject-CRITICAL **: g_object_unref: assertion
   `G_IS_OBJECT (object)' failed

Anyone knows what i am doing wrong? If not, I will file a bug in Bugzilla containing more debug-information.
I'm just a bit in a hurry right now :)

With regards,

Michi



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]