Quantcast

[Lazarus] g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed

classic Classic list List threaded Threaded
10 messages Options
ik
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Lazarus] g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed

ik
Hello,

I've created a short example to display how to use libnotify in Pascal.
The problem is that I'm getting the following exception:

(process:7633): GLib-CRITICAL **: g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed
(process:7633): GLib-CRITICAL **: g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed
(process:7633): GLib-CRITICAL **: g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed

The text as you can see, is pure "ASCII", so what am I missing or doing wrong here ?

Ido

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Lazarus] RE : g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed

Ludo Brands
Message

 
Hello,

I've created a short example to display how to use libnotify in Pascal.
The problem is that I'm getting the following exception:

(process:7633): GLib-CRITICAL **: g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed
(process:7633): GLib-CRITICAL **: g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed
(process:7633): GLib-CRITICAL **: g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed

The text as you can see, is pure "ASCII", so what am I missing or doing wrong here ?

Ido
 
Forgot to call gtk_init?
 
Ludo 

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
ik
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Lazarus] RE : g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed

ik
2011/12/14 Ludo Brands <[hidden email]>

 
Hello,

I've created a short example to display how to use libnotify in Pascal.
The problem is that I'm getting the following exception:

(process:7633): GLib-CRITICAL **: g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed
(process:7633): GLib-CRITICAL **: g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed
(process:7633): GLib-CRITICAL **: g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed

The text as you can see, is pure "ASCII", so what am I missing or doing wrong here ?

Ido
 
Forgot to call gtk_init?

That's create now gibrish as text :(

The original code that I tested was in C:
#include <libnotify/notify.h>
void main () {
  notify_init ("Hello world!");
  NotifyNotification * Hello = notify_notification_new ("Hello world", "This is an example notification.", "dialog-information");
  notify_notification_show (Hello, NULL);
  notify_uninit ();
}

And after compiling it as follows:
gcc -o notify `pkg-config --cflags --libs libnotify` notify.c

It properly display the text, however the Pascal code does not, even with gtk_init(@argc, @argv) :(


 
 
Ludo 


Ido
--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus



--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Lazarus] RE : RE : g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed

Ludo Brands
Message
 
-----Message d'origine-----
De : ik [mailto:[hidden email]]
Envoyé : mercredi 14 décembre 2011 17:05
À : Lazarus mailing list
Objet : Re: [Lazarus] RE : g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed

2011/12/14 Ludo Brands <[hidden email]>

 
Hello,

I've created a short example to display how to use libnotify in Pascal.
The problem is that I'm getting the following exception:

(process:7633): GLib-CRITICAL **: g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed
(process:7633): GLib-CRITICAL **: g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed
(process:7633): GLib-CRITICAL **: g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed

The text as you can see, is pure "ASCII", so what am I missing or doing wrong here ?

Ido
 
Forgot to call gtk_init?

That's create now gibrish as text :(

The original code that I tested was in C:
#include <libnotify/notify.h>
void main () {
  notify_init ("Hello world!");
  NotifyNotification * Hello = notify_notification_new ("Hello world", "This is an example notification.", "dialog-information");
  notify_notification_show (Hello, NULL);
  notify_uninit ();
}

And after compiling it as follows:
gcc -o notify `pkg-config --cflags --libs libnotify` notify.c

It properly display the text, however the Pascal code does not, even with gtk_init(@argc, @argv) :(


 
AFAIK, the use of constref for cdecl parameters is wrong in libnotify.pas.
 
Ludo
 

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
ik
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Lazarus] RE : RE : g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed

ik
2011/12/14 Ludo Brands <[hidden email]>
 
-----Message d'origine-----
De : ik [mailto:[hidden email]]
Envoyé : mercredi 14 décembre 2011 17:05
À : Lazarus mailing list
Objet : Re: [Lazarus] RE : g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed

2011/12/14 Ludo Brands <[hidden email]>

 
Hello,

I've created a short example to display how to use libnotify in Pascal.
The problem is that I'm getting the following exception:

(process:7633): GLib-CRITICAL **: g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed
(process:7633): GLib-CRITICAL **: g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed
(process:7633): GLib-CRITICAL **: g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed

The text as you can see, is pure "ASCII", so what am I missing or doing wrong here ?

Ido
 
Forgot to call gtk_init?

That's create now gibrish as text :(

The original code that I tested was in C:
#include <libnotify/notify.h>
void main () {
  notify_init ("Hello world!");
  NotifyNotification * Hello = notify_notification_new ("Hello world", "This is an example notification.", "dialog-information");
  notify_notification_show (Hello, NULL);
  notify_uninit ();
}

And after compiling it as follows:
gcc -o notify `pkg-config --cflags --libs libnotify` notify.c

It properly display the text, however the Pascal code does not, even with gtk_init(@argc, @argv) :(


 
AFAIK, the use of constref for cdecl parameters is wrong in libnotify.pas.

Indeed that was the problem. So what does constref is used for ?!

Thanks Ludo
 
 
Ludo

Ido
 

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus



--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Lazarus] RE : RE : RE : g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed

Ludo Brands
Message
 
AFAIK, the use of constref for cdecl parameters is wrong in libnotify.pas.

Indeed that was the problem. So what does constref is used for ?!

Thanks Ludo
 
 
Constref is passing a value by its reference (as in var paramter) with the promise that the callee won't change it. In this case you want to pass the pchar and not a pointer to the pchar (ppchar).
 
Ludo
 

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Lazarus] RE : RE : g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed

Felipe Monteiro de Carvalho
In reply to this post by ik
2011/12/14 ik <[hidden email]>:
> Indeed that was the problem. So what does constref is used for ?!

Surely not to convert c headers, I've never seen it be used for that.

--
Felipe Monteiro de Carvalho

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
ik
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Lazarus] RE : RE : g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed

ik



On Wed, Dec 14, 2011 at 18:25, Felipe Monteiro de Carvalho <[hidden email]> wrote:
2011/12/14 ik <[hidden email]>:
> Indeed that was the problem. So what does constref is used for ?!

Surely not to convert c headers, I've never seen it be used for that.

The reason I used it was this wiki entry: http://wiki.freepascal.org/FPC_New_Features_2.6.0#Constref_parameter_modifier
I guess i did not understand it correctly...
 

--
Felipe Monteiro de Carvalho

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Lazarus] RE : RE : RE : g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed

Ludo Brands
In reply to this post by ik
A small suggestion for the example: test the libnotify version. The header
conversion is based on 0.7.0 which is fairly recent. Ubuntu 10.04, the
latest LTS, still only has version 0.4.5. The example crashes miserably with
this version since notify_notification_new had an additional parameter.

Note also that the example could be reduced to a one-liner without header
conversion:

Sysutils.ExecuteProcess('/usr/bin/notify-send','-i dialog-information
"Example for libnotify" "This is a simple example how to use libnotify."');

Notify-send comes with the libnotify package. I guess you need the header
translation for doing things that aren't possible with notify-send but for
the average user it is an easier alternative.

Ludo


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
ik
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Lazarus] RE : RE : RE : g_variant_new_string: assertion `g_utf8_validate (string, -1, NULL)' failed

ik
On Wed, Dec 14, 2011 at 19:42, Ludo Brands <[hidden email]> wrote:
A small suggestion for the example: test the libnotify version. The header
conversion is based on 0.7.0 which is fairly recent. Ubuntu 10.04, the
latest LTS, still only has version 0.4.5. The example crashes miserably with
this version since notify_notification_new had an additional parameter.

Wow 0.4.5 is from 2008 and unmaintained anymore. In Arch we have newer version :)
I'll create also binding for the 0.4 version.
 

Note also that the example could be reduced to a one-liner without header
conversion:

Sysutils.ExecuteProcess('/usr/bin/notify-send','-i dialog-information
"Example for libnotify" "This is a simple example how to use libnotify."');

Notify-send comes with the libnotify package. I guess you need the header
translation for doing things that aren't possible with notify-send but for
the average user it is an easier alternative.

Actually I started translating notify-send into Pascal as a bigger example (and mostly test).
Theidea is to use the library problematically and not  executing external programs (unlike "normal" users :))


Ludo


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Loading...