Re: Using g_signal_connect in an event handler
- From: David Nečas (Yeti) <yeti physics muni cz>
- To: gtk-app-devel-list gnome org
- Subject: Re: Using g_signal_connect in an event handler
- Date: Tue, 17 Oct 2006 20:11:00 +0200
On Tue, Oct 17, 2006 at 11:02:32AM -0700, Brian J. Tarricone wrote:
On 10/17/2006 5:17 AM, David Ne?as (Yeti) wrote:
On Tue, Oct 17, 2006 at 01:51:47PM +0200, Lorenzo Marcon wrote:
int main(int argc, char *argv[]) {
...
This is quite cumbersome...
Not to mention the fact that 'data' is allocated on the stack and ceases
to exist after this function exits, so the pointer you pass to
g_signal_connect() will be garbage later. Not only should you use a
struct for convenience as David suggests, but you need to allocate the
struct on the heap (via g_malloc() or g_new(), etc.).
I was about to write this too, then I realized the function
is main(). So in this particular case the code is probably
correct though weird. Anyway, it never hurts to warn of
this problem...
Yeti
--
Whatever.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]