After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 607902 - Calling a SourceFunc that was assigned a global function segfaults
Calling a SourceFunc that was assigned a global function segfaults
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Code Generator
0.7.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
: 597331 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-01-24 00:17 UTC by Sandino Flores-Moreno
Modified: 2010-03-22 21:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Initialize DelegateType local variables (988 bytes, patch)
2010-01-24 00:43 UTC, Marc-Andre Lureau
none Details | Review

Description Sandino Flores-Moreno 2010-01-24 00:17:18 UTC
This simple program:

  bool source_func() {
      return true;
  }
  void main() {
      SourceFunc f;
      f = source_func;
      f();
  }

Ends with a segfault when tried to execute it.
This is because vala is currently generating:

void _main (void) {
    	GDestroyNotify f_target_destroy_notify;
    	void* f_target = NULL;
    	GSourceFunc f = NULL;
    	GSourceFunc _tmp0_;
  ...
  ...
    }

The problem is the line:
        GDestroyNotify f_target_destroy_notify;

That is not being initialized to NULL and then should be:
        GDestroyNotify f_target_destroy_notify = NULL;
Comment 1 Marc-Andre Lureau 2010-01-24 00:43:19 UTC
Created attachment 152122 [details] [review]
Initialize DelegateType local variables

Fixes bug 607902.
Comment 2 Sandino Flores-Moreno 2010-01-28 00:37:43 UTC
I verified with current git, and it works fine.

Could you commit it please?
Comment 3 Jürg Billeter 2010-01-29 12:41:47 UTC
commit ecceaa16db8f975c5a3b8cc6c66e2d3aa84d7d42
Author: Marc-André Lureau <marcandre.lureau@gmail.com>
Date:   Sun Jan 24 01:43:05 2010 +0100

    Initialize DelegateType local variables
    
    Fixes bug 607902.
Comment 4 Jürg Billeter 2010-03-22 21:30:01 UTC
*** Bug 597331 has been marked as a duplicate of this bug. ***