mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
uppsrc: Fixed multiple valgrind detected problems
This commit is contained in:
commit
34450d942d
11 changed files with 27 additions and 12 deletions
|
|
@ -74,14 +74,19 @@ static void sSeed(uint64 *s)
|
|||
force_inline
|
||||
static uint64 *sState()
|
||||
{
|
||||
static bool forked;
|
||||
thread_local uint64 *s;
|
||||
if(!s) {
|
||||
if(!s || forked && Thread::IsMain()) {
|
||||
thread_local uint64 state[4];
|
||||
s = state;
|
||||
sSeed(s);
|
||||
#ifdef PLATFORM_POSIX
|
||||
if(Thread::IsMain()) // non-main threads do not work with fork anyway
|
||||
pthread_atfork(NULL, NULL, [] { sSeed(s); }); // reseed random generator after fork
|
||||
if(Thread::IsMain()) { // non-main threads do not work with fork anyway
|
||||
ONCELOCK {
|
||||
pthread_atfork(NULL, NULL, [] { forked = true; }); // reseed random generator after fork
|
||||
}
|
||||
forked = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return s;
|
||||
|
|
|
|||
|
|
@ -529,6 +529,7 @@ Ctrl::Ctrl() {
|
|||
destroying = false;
|
||||
multi_frame = false;
|
||||
frame.frame = &NullFrame();
|
||||
frame.SetView(Null);
|
||||
enabled = visible = wantfocus = initfocus = true;
|
||||
editable = true;
|
||||
backpaint = IsCompositedGui() ? FULLBACKPAINT : TRANSPARENTBACKPAINT;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ Ctrl::Frame Ctrl::AllocFrames(int alloc)
|
|||
size_t sz0 = alloc * sizeof(Frame);
|
||||
size_t sz = sz0;
|
||||
m.frames = (Frame *)MemoryAllocSz(sz);
|
||||
// memset(m.frames, 0, sz); _DBG_
|
||||
m.multi.alloc = alloc + (int)((sz - sz0) / sizeof(Frame));
|
||||
return m;
|
||||
}
|
||||
|
|
@ -42,6 +43,7 @@ void Ctrl::InsertFrame(int i, CtrlFrame& fr)
|
|||
else
|
||||
memmove(frame.frames + i + 1, frame.frames + i, (frame.multi.count - i) * sizeof(Frame));
|
||||
frame.frames[i].frame = &fr;
|
||||
frame.frames[i].SetView(Null);
|
||||
frame.multi.count++;
|
||||
}
|
||||
fr.FrameAdd(*this);
|
||||
|
|
|
|||
|
|
@ -114,6 +114,8 @@ Draw& ImageDraw::Alpha()
|
|||
if(!alpha_surface) {
|
||||
alpha_surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, isz.cx, isz.cy);
|
||||
alpha.cr = cairo_create(alpha_surface);
|
||||
// cairo_set_source_rgb(alpha.cr, 0, 0, 0);
|
||||
// cairo_paint(alpha.cr);
|
||||
}
|
||||
return alpha;
|
||||
}
|
||||
|
|
@ -181,6 +183,8 @@ void ImageDraw::Init(Size sz)
|
|||
isz = sz;
|
||||
surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, isz.cx, isz.cy);
|
||||
cr = cairo_create(surface);
|
||||
// cairo_set_source_rgb(cr, 0, 0, 0);
|
||||
// cairo_paint(cr);
|
||||
alpha_surface = NULL;
|
||||
del = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1053,11 +1053,11 @@ void EditField::Reset()
|
|||
errorbg = nobg = false;
|
||||
charset = CHARSET_UTF8;
|
||||
alignright = false;
|
||||
showspaces = false;
|
||||
no_internal_margin = false;
|
||||
SetStyle(StyleDefault());
|
||||
SetFrame(edge);
|
||||
font = StdFont();
|
||||
showspaces = false;
|
||||
no_internal_margin = false;
|
||||
fsell = fselh = -1;
|
||||
DeleteAttr<Image>(ATTR_NULLICON);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ TreeCtrl::TreeCtrl()
|
|||
multiroot = false;
|
||||
chldlck = false;
|
||||
highlight_ctrl = false;
|
||||
hasctrls = false;
|
||||
Clear();
|
||||
SetFrame(ViewFrame());
|
||||
AddFrame(sb);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ void ImageBuffer::Create(int cx, int cy)
|
|||
ASSERT(cx >= 0 && cy >= 0);
|
||||
size.cx = cx;
|
||||
size.cy = cy;
|
||||
pixels.Alloc(GetLength());
|
||||
pixels.Alloc(GetLength(), RGBAZero());
|
||||
#ifdef _DEBUG
|
||||
RGBA *s = pixels;
|
||||
RGBA *e = pixels + GetLength();
|
||||
|
|
|
|||
|
|
@ -207,6 +207,7 @@ void CurrentFileThread()
|
|||
current_file_event.Wait();
|
||||
LLOG("Current file Thread::IsShutdownThreads() " << Thread::IsShutdownThreads());
|
||||
}
|
||||
s_cf.Clear();
|
||||
LLOG("Current file thread exit");
|
||||
}
|
||||
|
||||
|
|
@ -221,7 +222,6 @@ void SetCurrentFile(const CurrentFileContext& ctx, Event<const CppFileInfo&> don
|
|||
Thread::Start([] { CurrentFileThread(); });
|
||||
Thread::AtShutdown([] {
|
||||
LLOG("Shutdown current file");
|
||||
s_cf.Clear();
|
||||
current_file_event.Broadcast();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,10 +135,10 @@ struct AnnotationItem : Moveable<AnnotationItem> {
|
|||
String nest; // Upp::Class
|
||||
String unest; // UPP::CLASS
|
||||
String bases; // base classes of struct/class
|
||||
Point pos;
|
||||
int kind;
|
||||
bool definition;
|
||||
bool isvirtual;
|
||||
Point pos = Null;
|
||||
int kind = Null;
|
||||
bool definition = false;
|
||||
bool isvirtual = false;
|
||||
|
||||
void Serialize(Stream& s);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
// we are using libclang.dll for MSVC and therefore need to redefine standard macros
|
||||
// to mingw clang
|
||||
|
||||
//#BLITZ_PROHIBIT
|
||||
|
||||
const char umacros[] =
|
||||
R"(#define CHECK_GRID(g)
|
||||
#define CHECK_MATRIX(g)
|
||||
|
|
|
|||
|
|
@ -531,7 +531,7 @@ public:
|
|||
LineEdit::EditPos editpos;
|
||||
Point columnline;
|
||||
LineEdit::UndoData undodata;
|
||||
int64 filehash; // make sure undodata work
|
||||
int64 filehash = 0; // make sure undodata work
|
||||
LineInfo lineinfo;
|
||||
LineInfoRem lineinforem;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue