fixed some mem leaks

This commit is contained in:
K D Hedger
2023-12-21 14:56:17 +00:00
parent 3b1edf43b2
commit 3db4bb7f3b
11 changed files with 48 additions and 20 deletions

View File

@ -1,4 +1,5 @@
0.2.0
Fixed mem leak.
Added date reminder file to calendar (~/.config/LFS/calendardates).
Added calendar widget.
Fixed updating window names in task lists.

View File

@ -227,6 +227,7 @@ int addCalendar(int x,int y,int grav)
editbox->LFSTK_moveGadget(0,0);
editbox->LFSTK_resizeWindow(txtwid,std::floor(txthite));
editbox->LFSTK_setStyle(BEVELNONE);
editbox->LFSTK_setEditable(false);
editbox->LFSTK_setIgnores(false,false);
editbox->LFSTK_addHighLights(dx,dy,dl,datesHilite[0]);

View File

@ -36,9 +36,11 @@ struct datesStruct
};
extern LFSTK_windowClass *calWindow;
extern bool calWindowVisible;
extern LFSTK_toggleButtonClass *calendarButton;
extern LFSTK_multiLineEditClass *editbox;
extern bool calWindowVisible;
extern bool calendarIsUp;
extern std::vector<datesStruct> datesData;
int addCalendar(int x,int y,int grav);

View File

@ -97,7 +97,6 @@ bool desktopSelect(void *object,void* userdata)
int addDesktopSwitcer(int x,int y,int grav)
{
char *icon=NULL;
windowInitStruct *win=new windowInitStruct;;
listLabelStruct ls;
std::string label;
propertyStruct props;

View File

@ -239,6 +239,7 @@ int addLaunchers(int x,int y,int grav)
entry.name=NULL;
entry.exec=NULL;
entry.inTerm=false;
freeAndNull(&icon);
addALAuncher(findlaunchers->data.at(l).path.c_str(),&entry);
@ -266,10 +267,11 @@ int addLaunchers(int x,int y,int grav)
else
bc->LFSTK_setImageFromPath(DATADIR "/pixmaps/command.png",LEFT,true);
freeAndNull(&icon);
//freeAndNull(&entry.icon);
setGadgetDetails(bc);
if(icon!=NULL)
freeAndNull(&icon);
//if(icon!=NULL)
// freeAndNull(&icon);
launchersArray.push_back(lds);
g_free(entry.name);
g_free(entry.exec);

View File

@ -314,20 +314,38 @@ int main(int argc,char **argv)
int retval=apc->LFSTK_runApp();
/*
extern LFSTK_windowClass *calWindow;
extern bool calWindowVisible;
extern LFSTK_toggleButtonClass *calendarButton;
extern bool calendarIsUp;
*/
//delete editbox;
//delete calWindow;
//delete calendarButton;
calendarIsUp=false;
freeAndNull(&iconL);
freeAndNull(&iconM);
freeAndNull(&iconH);
clockButton=NULL;
switchButton=NULL;
gotLaunchers=false;
useTaskBar=false;
holdtasks.clear();
filltasks.clear();
tasks.clear();
launchersArray.clear();
datesData.clear();
delete gFind;
delete findlaunchers;
delete apc;
clockButton=NULL;
switchButton=NULL;
calendarButton=NULL;
editbox=NULL;
calWindow=NULL;
gotLaunchers=false;
useTaskBar=false;
}
cairo_debug_reset_static_data();
g_key_file_free(kf);

View File

@ -263,7 +263,8 @@ skiplabel:
for(int j=0;j<filltasks.size();j++)
{
icon=NULL;
// icon=NULL;
freeAndNull(&icon);
icon=dockWindow->globalLib->LFSTK_findThemedIcon(desktopTheme,filltasks.at(j).taskClass[0].c_str(),"");
if(icon==NULL)
icon=dockWindow->globalLib->LFSTK_findThemedIcon(desktopTheme,filltasks.at(j).taskClass[1].c_str(),"");

View File

@ -1,4 +1,5 @@
0.6.0
Fixed memleaks.
Fixed bevel in multi line class.
Fixed extra highlighting in multi box.
Fixed minor memory leak in window/application class.

View File

@ -561,8 +561,8 @@ char* LFSTK_lib::LFSTK_findThemedIcon(const char *theme,const char *icon,const c
char *iconpath=NULL;
const char *iconthemes[3];
const char *iconfolders[GLOBALPIXMAPSEND];
bool maskdot=false;
char *holdicon=NULL;
bool maskdot=false;
char *holdicon=NULL;
if(icon[0]=='/')
return(strdup(icon));
@ -596,9 +596,9 @@ char* LFSTK_lib::LFSTK_findThemedIcon(const char *theme,const char *icon,const c
if((iconpath!=NULL) && (strlen(iconpath)>1))
goto breakReturn;
if(iconpath!=NULL)
freeAndNull(&iconpath);
iconpath=NULL;
//if(iconpath!=NULL)
freeAndNull(&iconpath);
//iconpath=NULL;
}
}
@ -617,6 +617,7 @@ char* LFSTK_lib::LFSTK_findThemedIcon(const char *theme,const char *icon,const c
breakReturn:
freeAndNull(&holdicon);
//freeAndNull(&iconpath);
return(iconpath);
}
@ -806,9 +807,11 @@ char* LFSTK_lib::LFSTK_oneLiner(const char* fmt,...)
}
pclose(fp);
freeAndNull(&subbuffer);
return(strdup(buffer));
//return(strdup(buffer));
return(buffer);
}
freeAndNull(&subbuffer);
freeAndNull(&buffer);
return(NULL);
}
@ -1223,6 +1226,8 @@ void LFSTK_lib::LFSTK_getFileInfo(const char* path,fileInformation* info)
file=g_file_new_for_path(path);
file_info=g_file_query_info(file,"standard::*",G_FILE_QUERY_INFO_NONE,NULL,&error);
th=g_file_info_get_content_type(file_info);
g_clear_object(&file);
g_clear_object(&file_info);
if(th.length()!=0)
info->mimeType=th;
else

View File

@ -41,6 +41,7 @@ LFSTK_multiLineEditClass::~LFSTK_multiLineEditClass()
}
this->lines.clear();
}
this->highLights.clear();
}
LFSTK_multiLineEditClass::LFSTK_multiLineEditClass()
@ -226,9 +227,6 @@ void LFSTK_multiLineEditClass::drawText(void)
cairo_save(this->cr);
cairo_reset_clip(this->cr);
cairo_set_source_rgba(this->cr,this->newGadgetBGColours.at(NORMALCOLOUR).RGBAColour.r,this->newGadgetBGColours.at(NORMALCOLOUR).RGBAColour.g,this->newGadgetBGColours.at(NORMALCOLOUR).RGBAColour.b,this->newGadgetBGColours.at(NORMALCOLOUR).RGBAColour.a);
//cairo_rectangle(this->cr,0,0,this->gadgetGeom.w-1,this->gadgetGeom.h-1);
// cairo_fill(this->cr);
cairo_paint(this->cr);
cairo_restore(this->cr);

View File

@ -119,7 +119,7 @@ makelocal ()
#runCommand "./autogen.sh --prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX}"
:
else
CFLAGS="-Wfatal-errors -I${CWD}/LFSToolKit/LFSToolKit/lfstk/ -L${CWD}/LFSToolKit/LFSToolKit/app/.libs"
CFLAGS="-O0 -g -Wfatal-errors -I${CWD}/LFSToolKit/LFSToolKit/lfstk/ -L${CWD}/LFSToolKit/LFSToolKit/app/.libs"
CXXFLAGS="$CFLAGS"
export CFLAGS CXXFLAGS
runCommand "./autogen.sh --prefix=/usr"