Skip to content

Commit 1e599c2

Browse files
committed
use correct interlockdincrement for log
1 parent 6df3ee4 commit 1e599c2

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

src/listview.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,15 @@ VOID _app_listview_addnetworkitem (
179179

180180
VOID _app_listview_addlogitem (
181181
_In_ HWND hwnd,
182+
_In_ PITEM_LOG ptr_log,
182183
_In_ ULONG log_hash
183184
)
184185
{
186+
// increment value
187+
_InterlockedIncrement (&config.log_id);
188+
189+
ptr_log->log_id = _InterlockedCompareExchange (&config.log_id, 0, 0);
190+
185191
_r_listview_additem (hwnd, IDC_LOG, INT_ERROR, LPSTR_TEXTCALLBACK, I_IMAGECALLBACK, 0, _app_listview_createcontext (log_hash));
186192
}
187193

src/listview.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ VOID _app_listview_addnetworkitem (
6363

6464
VOID _app_listview_addlogitem (
6565
_In_ HWND hwnd,
66+
_In_ PITEM_LOG ptr_log,
6667
_In_ ULONG log_hash
6768
);
6869

src/log.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ VOID _app_logwrite_ui (
316316
_r_obj_addhashtablepointer (log_table, log_hash, _r_obj_reference (ptr_log));
317317
_r_queuedlock_releaseexclusive (&lock_loglist);
318318

319-
_app_listview_addlogitem (hwnd, log_hash);
319+
_app_listview_addlogitem (hwnd, ptr_log, log_hash);
320320

321321
_app_queue_resolver (hwnd, IDC_LOG, log_hash, ptr_log);
322322

@@ -1422,15 +1422,7 @@ VOID NTAPI _app_logthread (
14221422
{
14231423
// write log to a ui
14241424
if (is_loguienabled)
1425-
{
1426-
// increment value
1427-
_InterlockedIncrement (&config.log_id);
1428-
1429-
ptr_log->log_id = _InterlockedCompareExchange (&config.log_id, 0, 0);
1430-
1431-
// write to a ui
1432-
_app_logwrite_ui (hwnd, ptr_log);
1433-
}
1425+
_app_logwrite_ui (hwnd, ptr_log); // write to a ui
14341426
}
14351427
}
14361428

0 commit comments

Comments
 (0)