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 677680 - Crash in focus() because of cursor_child being null
Crash in focus() because of cursor_child being null
Status: RESOLVED FIXED
Product: egg-list-box
Classification: Other
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: egg-list-box-maint
egg-list-box-maint
Depends on:
Blocks:
 
 
Reported: 2012-06-08 08:12 UTC by Guillaume Desmottes
Modified: 2012-06-11 08:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fix style of focus() (5.18 KB, patch)
2012-06-08 08:13 UTC, Guillaume Desmottes
none Details | Review
focus: early return if cursor_child is null (948 bytes, patch)
2012-06-08 08:13 UTC, Guillaume Desmottes
none Details | Review
fix style of focus() (5.18 KB, patch)
2012-06-08 08:14 UTC, Guillaume Desmottes
committed Details | Review
focus: cope with cursor_child being null (1.05 KB, patch)
2012-06-08 10:45 UTC, Guillaume Desmottes
none Details | Review
focus: cope with cursor_child being null (1.00 KB, patch)
2012-06-11 07:39 UTC, Guillaume Desmottes
committed Details | Review

Description Guillaume Desmottes 2012-06-08 08:12:49 UTC
Atm we have:
        /* TODO: Handle null cursor child */

I'm experiencing a crash because of this. I have no idea what's the right way to handle this but an early return fixes my crash.
Comment 1 Guillaume Desmottes 2012-06-08 08:13:28 UTC
Created attachment 215914 [details] [review]
fix style of focus()

No semantic change, I just add working on miss aligned code.
Comment 2 Guillaume Desmottes 2012-06-08 08:13:31 UTC
Created attachment 215915 [details] [review]
focus: early return if cursor_child is null
Comment 3 Guillaume Desmottes 2012-06-08 08:14:07 UTC
Created attachment 215916 [details] [review]
fix style of focus()

No semantic change, I just hate working on miss aligned code.
Comment 4 Alexander Larsson 2012-06-08 10:15:09 UTC
I don't see any missalignment? Are you using 8 space tabs?

Also, i think returning early is not really right, or at least it doesn't go with the rest of the code very nicely.

Just don't set recurse_into if cursor_child is null. That will avoid the crash, and then set focus_into to false which will make us return.
Comment 5 Guillaume Desmottes 2012-06-08 10:45:35 UTC
Created attachment 215926 [details] [review]
focus: cope with cursor_child being null
Comment 6 Guillaume Desmottes 2012-06-08 10:46:15 UTC
(In reply to comment #4)
> I don't see any missalignment? Are you using 8 space tabs?

The line I changed are tabs aligned while most the of file if spaces aligned.

> Also, i think returning early is not really right, or at least it doesn't go
> with the rest of the code very nicely.
> 
> Just don't set recurse_into if cursor_child is null. That will avoid the crash,
> and then set focus_into to false which will make us return.

done.
Comment 7 Guillaume Desmottes 2012-06-11 07:39:29 UTC
Created attachment 216087 [details] [review]
focus: cope with cursor_child being null
Comment 8 Guillaume Desmottes 2012-06-11 07:41:52 UTC
Attachment 215916 [details] pushed as 6adf9cb - fix style of focus()
Attachment 216087 [details] pushed as f43820e - focus: cope with cursor_child being null
Comment 9 Alexander Larsson 2012-06-11 08:01:33 UTC
As for the indentation, it uses 8 space tabs, and spaces wherever the indentation is less than 8 spaces (obviously).