Crash in Mac version of zyGrib

Image Ici on parle français ou anglais, comme on veut, comme on peut.
Image Here we speak french or english, as we want, as we can.

Moderator: jza

Forum rules
Image Ici on parle français ou anglais, comme on veut, comme on peut, mais on n'oublie jamais que l'on discute entre humains.
Il ne faut surtout pas oublier les mots magiques: bonjour, salut, merci, etc.
Les messages impolis sont rejetés et restent sans réponse.
Il faut souvent être patient, car il y a plein d'autres activités encore plus passionantes dans notre vie.

Image Here we speak french or english, as we want, as we can, but we never forget that we discuss between humans.
Do not forget the magic words: hello, hi, thank you, etc.
Rude messages are rejected and remain unanswered.
It is often necessary to be patient because there are many other activities even more exciting in our life.
Post Reply
lsoltero
Posts: 9
Joined: 18 Sep 2014 07:16

Crash in Mac version of zyGrib

Post by lsoltero » 28 Jan 2016 20:56

It seems that on some machines zyGrib crashes on start up when it tries to load and render a grib file that was previously downloaded.

here is stack trace
(gdb) where
#0 GriddedPlotter::draw_CoveredZone (this=0x0, pnt=@0x7fff5fbf99d8, proj=0x101cc9550) at GriddedPlotter.cpp:370
#1 0x0000000100161fd5 in MapDrawer::draw_MeteoData_Gridded (this=0x10b6399c0, pnt=@0x7fff5fbf99d8, proj=0x101cc9550, plotter=0x0) at MapDrawer.cpp:416
#2 0x0000000100161eb9 in MapDrawer::draw_GSHHS_and_GriddedData (this=0x10b6399c0, pntGlobal=@0x7fff5fbf9be8, mustRedraw=true, isEarthMapValid=false, proj=0x101cc9550, plotter=0x0, drawCartouche=true) at MapDrawer.cpp:374
#3 0x00000001001df615 in Terrain::paintEvent (this=0x10b639240) at Terrain.cpp:1086
#4 0x0000000100c00a2e in QWidget::event ()

the following mod to line 1086 in Terrain.cpp fixes the problem

case DATATYPE_MBLUE :
// added to fix crash
if ( griddedPlot == NULL ) {
setCursor(oldcursor);
return;
}
// end of crash fix
drawer->draw_GSHHS_and_GriddedData
(pnt, mustRedraw, isEarthMapValid, proj, griddedPlot, drawCartouche);


it seems that there is some race condition that causes printEvent to be called before the GriddedPlotter data structure is initialized. Depending on the speed of your computer, disk, load, etc the Grid may or may not be loaded before the screen refresh. When this happens the griddedPlot variable is 0. which is an invalid address which causes an exception.

--luis

lsoltero
Posts: 9
Joined: 18 Sep 2014 07:16

Re: Crash in Mac version of zyGrib

Post by lsoltero » 28 Jan 2016 21:41

here is the patch file. I tried to attache it but keep getting "The extension patch is not allowed" so here it is

Code: Select all

===================================================================
--- Terrain.cpp	(revision 4477)
+++ Terrain.cpp	(working copy)
@@ -1083,6 +1083,10 @@
         switch (currentFileType) {
 			case DATATYPE_GRIB :
 			case DATATYPE_MBLUE :
+			  if ( griddedPlot == NULL ) {
+			    setCursor(oldcursor);
+			    return;
+			  }
 				drawer->draw_GSHHS_and_GriddedData 
 					(pnt, mustRedraw, isEarthMapValid, proj, griddedPlot, drawCartouche);
 				break;

jza
Site Admin
Posts: 601
Joined: 19 Jan 2009 00:22

Re: Crash in Mac version of zyGrib

Post by jza » 14 Feb 2016 09:38

Hi,
This bug has never been signaled, and I can't reproduce it.
But your correction is very simple, so it will still be implemented in a future version.
Tanks for this participation.
A+
Jacques

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests