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 343546 - devilspie segfaults in 'center' funtion
devilspie segfaults in 'center' funtion
Status: RESOLVED FIXED
Product: devilspie
Classification: Other
Component: general
0.17
Other All
: Normal critical
: ---
Assigned To: Devilspie Maintainers
Devilspie Maintainers
: 420097 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-05-31 23:32 UTC by Michal Jaegermann
Modified: 2007-09-23 19:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch which prevents segfault described above (753 bytes, patch)
2006-05-31 23:42 UTC, Michal Jaegermann
none Details | Review

Description Michal Jaegermann 2006-05-31 23:32:07 UTC
Please describe the problem:
A documentation for 'libwnck' has the following to say about
'wnck_screen_get_active_workspace ()':
"May return NULL sometimes, if we are in a weird state due to the asynchronous
nature of our interaction with the window manager".  At least with the
current libwnck-2.15.2-2 (Fedora "rawhide") we are actually getting
NULL always, AFICS, at least in my tests.

Unfortunately func_center() is using this function and is passing the
resulting NULL to wnck_workspace_get_width(), without checks, and this
is causing an immediate segfault.

Steps to reproduce:
1. provide in ~/.devilspie/ a .ds file which uses (center)
2. run devilspie 0.17.1 at least with some version of libwnck libraries
3. 


Actual results:
segfault

Expected results:


Does this happen every time?


Other information:
Comment 1 Michal Jaegermann 2006-05-31 23:42:39 UTC
Created attachment 66563 [details] [review]
patch which prevents segfault described above

if 'wnck_screen_get_workspace ()' is used instead then, at least in my tests,
NULL is not returned.  OTOH maybe there are situations when geometry of other
workspaces is different then geometry of workspace 0 but I did not have a better
workaround at this moment.  In any case a return value should be checked.

With this patch, and the one from bug #330067, (center) does work as expected.
Comment 2 Ross Burton 2006-06-04 18:06:03 UTC
In what situations would get_active_workspace() fail?
Comment 3 Michal Jaegermann 2006-06-04 20:54:23 UTC
On my current test setup ("rawhide" for Fedora Core,
libwnck-2.15.2-2) 'wnck_screen_get_active_workspace()'
consistently returns NULL _always_ when I am trying to use it
in 'func_center()'.  In an unpatched code this mean an
instant segfault.

It is difficult to classify that as "fail" if a documentation
explicitely states that NULL may be returned "... due to the
asynchronous nature of our interaction with the window manager".
If there is some documented way to force such synchronization,
so a non-NULL 'workspace' pointer will be always returned,
I really have no idea.
Comment 4 Cédric Bellegarde 2006-07-04 14:33:50 UTC
Same bug here.

With compiz, i try to force all windows to be centered at startup.

gnumdk@flanders:~/.devilspie$ cat all.ds
(if
    (matches (application_name) ".*")
    (begin
       (center)
    )
)
gnumdk@flanders:~/.devilspie$ devilspie
Erreur de segmentation (segfault in french)
gnumdk@flanders:~/.devilspie$
Comment 5 Ross Burton 2007-09-23 19:41:49 UTC
A similar patch has been committed to svn.
Comment 6 Ross Burton 2007-09-23 19:43:30 UTC
*** Bug 420097 has been marked as a duplicate of this bug. ***